本文整理汇总了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()
示例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)
示例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
示例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()