当前位置: 首页>>代码示例>>Python>>正文


Python ColumnFamily.get_indexed_slices方法代码示例

本文整理汇总了Python中pycassa.ColumnFamily.get_indexed_slices方法的典型用法代码示例。如果您正苦于以下问题:Python ColumnFamily.get_indexed_slices方法的具体用法?Python ColumnFamily.get_indexed_slices怎么用?Python ColumnFamily.get_indexed_slices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pycassa.ColumnFamily的用法示例。


在下文中一共展示了ColumnFamily.get_indexed_slices方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_indexed_slices_batching

# 需要导入模块: from pycassa import ColumnFamily [as 别名]
# 或者: from pycassa.ColumnFamily import get_indexed_slices [as 别名]
    def test_get_indexed_slices_batching(self):
        indexed_cf = ColumnFamily(self.client, 'Indexed1')

        columns = {'birthdate': 1L}

        for i in range(200):
            indexed_cf.insert('key%d' % i, columns)

        expr = index.create_index_expression(column_name='birthdate', value=1L)
        clause = index.create_index_clause([expr], count=10)

        result = list(indexed_cf.get_indexed_slices(clause, buffer_size=2))
        assert_equal(len(result), 10)
        result = list(indexed_cf.get_indexed_slices(clause, buffer_size=10))
        assert_equal(len(result), 10)
        result = list(indexed_cf.get_indexed_slices(clause, buffer_size=77))
        assert_equal(len(result), 10)
        result = list(indexed_cf.get_indexed_slices(clause, buffer_size=200))
        assert_equal(len(result), 10)
        result = list(indexed_cf.get_indexed_slices(clause, buffer_size=1000))
        assert_equal(len(result), 10)

        clause = index.create_index_clause([expr], count=250)

        result = list(indexed_cf.get_indexed_slices(clause, buffer_size=2))
        assert_equal(len(result), 200)
        result = list(indexed_cf.get_indexed_slices(clause, buffer_size=10))
        assert_equal(len(result), 200)
        result = list(indexed_cf.get_indexed_slices(clause, buffer_size=77))
        assert_equal(len(result), 200)
        result = list(indexed_cf.get_indexed_slices(clause, buffer_size=200))
        assert_equal(len(result), 200)
        result = list(indexed_cf.get_indexed_slices(clause, buffer_size=1000))
        assert_equal(len(result), 200)
开发者ID:dln,项目名称:pycassa,代码行数:36,代码来源:test_columnfamily.py

示例2: insert_insert_get_indexed_slices

# 需要导入模块: from pycassa import ColumnFamily [as 别名]
# 或者: from pycassa.ColumnFamily import get_indexed_slices [as 别名]
    def insert_insert_get_indexed_slices(self):
        indexed_cf = ColumnFamily(self.client, 'Indexed1')

        columns = {'birthdate': 1L}

        keys = []
        for i in range(1,4):
            indexed_cf.insert('key%d' % i, columns)
            keys.append('key%d')

        expr = index.create_index_expression(column_name='birthdate', value=1L)
        clause = index.create_index_clause([expr])

        count = 0
        for key,cols in indexed_cf.get_indexed_slices(clause):
            assert cols == columns
            assert key in keys
            count += 1
        assert_equal(count, 3)
开发者ID:dln,项目名称:pycassa,代码行数:21,代码来源:test_columnfamily.py

示例3: insert_insert_get_indexed_slices

# 需要导入模块: from pycassa import ColumnFamily [as 别名]
# 或者: from pycassa.ColumnFamily import get_indexed_slices [as 别名]
    def insert_insert_get_indexed_slices(self):
        indexed_cf = ColumnFamily(pool, "Indexed1")

        columns = {"birthdate": 1L}

        keys = []
        for i in range(1, 4):
            indexed_cf.insert("key%d" % i, columns)
            keys.append("key%d")

        expr = index.create_index_expression(column_name="birthdate", value=1L)
        clause = index.create_index_clause([expr])

        count = 0
        for key, cols in indexed_cf.get_indexed_slices(clause):
            assert_equal(cols, columns)
            assert key in keys
            count += 1
        assert_equal(count, 3)
开发者ID:anisnasir,项目名称:pycassa,代码行数:21,代码来源:test_columnfamily.py

示例4: test_insert_get_indexed_slices

# 需要导入模块: from pycassa import ColumnFamily [as 别名]
# 或者: from pycassa.ColumnFamily import get_indexed_slices [as 别名]
    def test_insert_get_indexed_slices(self):
        indexed_cf = ColumnFamily(self.client, 'Indexed1')

        columns = {'birthdate': 1L}

        key = 'key1'
        indexed_cf.insert(key, columns, write_consistency_level=ConsistencyLevel.ONE)

        key = 'key2'
        indexed_cf.insert(key, columns, write_consistency_level=ConsistencyLevel.ONE)

        key = 'key3'
        indexed_cf.insert(key, columns, write_consistency_level=ConsistencyLevel.ONE)

        expr = index.create_index_expression(column_name='birthdate', value=1L)
        clause = index.create_index_clause([expr])
        result = indexed_cf.get_indexed_slices(clause)
        assert len(result) == 3
        assert result.get('key1') == columns
        assert result.get('key2') == columns
        assert result.get('key3') == columns
开发者ID:eevans,项目名称:pycassa,代码行数:23,代码来源:test_columnfamily.py


注:本文中的pycassa.ColumnFamily.get_indexed_slices方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。