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


Python ColumnFamily.truncate方法代码示例

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


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

示例1: truncate_log_metadata

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import truncate [as 别名]
    def truncate_log_metadata(self):
        for cf in ['build_timelines']:
            cf = ColumnFamily(self.pool, cf)
            cf.truncate()

        cf = ColumnFamily(self.pool, 'indices')
        for key in LOG_METADATA_INDICES:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'counters')
        for key in LOG_METADATA_COUNTERS:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'super_counters')
        for key in LOG_METADATA_SUPER_COUNTERS:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'builds')
        batch = cf.batch()
        # Remove log parsing state from builds.
        for key, cols in cf.get_range(columns=['log_parsing_version']):
            if 'log_parsing_version' not in cols:
                continue

            batch.remove(key, ['log_parsing_version'])

        batch.send()
开发者ID:AutomatedTester,项目名称:mozilla-build-analyzer,代码行数:29,代码来源:cassandra.py

示例2: truncate_build_metadata

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import truncate [as 别名]
    def truncate_build_metadata(self):
        """Truncates all derived build metadata.

        This bulk removes all build metadata and should not be performed
        unless you want to reload all derived data!
        """
        for cf in ['slaves', 'masters', 'builders', 'builds']:
            cf = ColumnFamily(self.pool, cf)
            cf.truncate()

        cf = ColumnFamily(self.pool, 'indices')
        for key in BUILD_METADATA_INDICES:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'simple_indices')
        for key in BUILD_METADATA_SIMPLE_INDICES:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'counters')
        for key in BUILD_METADATA_COUNTERS:
            cf.remove(key)

        cf = ColumnFamily(self.pool, 'super_counters')
        for key in BUILD_METADATA_SUPER_COUNTERS:
            cf.remove(key)
开发者ID:AutomatedTester,项目名称:mozilla-build-analyzer,代码行数:27,代码来源:cassandra.py

示例3:

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import truncate [as 别名]
    for i in keycoll :
        nbread+=1
        res = col_fam.get(str(i))
    
    end=datetime.datetime.utcnow()
    result=end-start
    print "read time: ", result
    print "read time per record: ", result/nbread
    
    print ""
    print "******Delete******"
    
    start=datetime.datetime.utcnow()
    
    #col_fam.remove('John')
    col_fam.truncate()
    
    end=datetime.datetime.utcnow()
    result=end-start
    print "delete time: ", result
    print "delete time per record: ", result/NUM_INSERT
    
    print "" 
    print "******Drop******"
    
    start=datetime.datetime.utcnow()
    

    
    end=datetime.datetime.utcnow()
    result=end-start
开发者ID:GustavePate,项目名称:sandbox,代码行数:33,代码来源:CassandraMain.py

示例4:

# 需要导入模块: from pycassa.columnfamily import ColumnFamily [as 别名]
# 或者: from pycassa.columnfamily.ColumnFamily import truncate [as 别名]
print count 

count=author_cf.multiget_count(["sacharya1","sacharya2"])
print count
################################## REMOVE #####################################
# Remove the column for the row key and column key
print "Removing the column last_name for row key sacharya1"
author_cf.remove('sacharya1', columns=['last_name'])

time.sleep(5)

authors = author_cf.get('sacharya')
print authors

# REMOVE the entire row
author_cf.remove('sacharya')
try:
    time.sleep(5)
    print "Getting object already deleted"
    author_cf.get('sacharya')
except Exception as e:
    print e

# Delete all data from column family
author_cf.truncate()

############################### DROP KEYSPACE #################################
sys.drop_keyspace('entries')
pool.dispose()

开发者ID:sacharya,项目名称:cassandra-101,代码行数:31,代码来源:cassandra-pycassa.py


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