本文整理汇总了Python中corehq.apps.receiverwrapper.models.RepeatRecord.get_db方法的典型用法代码示例。如果您正苦于以下问题:Python RepeatRecord.get_db方法的具体用法?Python RepeatRecord.get_db怎么用?Python RepeatRecord.get_db使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.receiverwrapper.models.RepeatRecord
的用法示例。
在下文中一共展示了RepeatRecord.get_db方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from corehq.apps.receiverwrapper.models import RepeatRecord [as 别名]
# 或者: from corehq.apps.receiverwrapper.models.RepeatRecord import get_db [as 别名]
def handle(self, *args, **options):
domain = args[0]
old_db = Domain.get_db()
new_db = RepeatRecord.get_db()
assert old_db.dbname != new_db.dbname
doc_ids = get_doc_ids(domain, 'RepeatRecord', old_db)
count = len(doc_ids)
chunksize = 250
for i, docs in enumerate(chunked(iter_docs(old_db, doc_ids, chunksize), chunksize)):
for doc in docs:
if '_rev' in doc:
del doc['_rev']
new_db.bulk_save(docs, new_edits=False)
print 'checked %s / %s' % (i * chunksize, count)
示例2: handle
# 需要导入模块: from corehq.apps.receiverwrapper.models import RepeatRecord [as 别名]
# 或者: from corehq.apps.receiverwrapper.models.RepeatRecord import get_db [as 别名]
def handle(self, *args, **options):
domain = args[0]
old_db = Domain.get_db()
new_db = RepeatRecord.get_db()
assert old_db.dbname != new_db.dbname
doc_ids = [
r["id"]
for r in old_db.view(
"domain/docs", startkey=[domain, "RepeatRecord"], endkey=[domain, "RepeatRecord", {}], reduce=False
)
]
count = len(doc_ids)
chunksize = 250
for i, docs in enumerate(chunked(iter_docs(old_db, doc_ids, chunksize), chunksize)):
for doc in docs:
if "_rev" in doc:
del doc["_rev"]
new_db.bulk_save(docs, new_edits=False)
print "checked %s / %s" % (i * chunksize, count)