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


Python ExportSchema.get_all_checkpoints方法代码示例

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


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

示例1: test_get_all_checkpoints

# 需要导入模块: from couchexport.models import ExportSchema [as 别名]
# 或者: from couchexport.models.ExportSchema import get_all_checkpoints [as 别名]
    def test_get_all_checkpoints(self):
        index = ["mydomain", "myxmlns"]
        self.addCleanup(lambda: [cp.delete() for cp in ExportSchema.get_all_checkpoints(index)])

        schema1 = ExportSchema(index=index, timestamp=datetime.utcnow())
        schema1.save()
        schema1_prime, = list(ExportSchema.get_all_checkpoints(index))
        self.assert_docs_equal(schema1_prime, schema1)
        schema2 = ExportSchema(index=index, timestamp=datetime.utcnow())
        schema2.save()
        schema1_prime, schema2_prime = list(ExportSchema.get_all_checkpoints(index))
        self.assert_docs_equal(schema1_prime, schema1)
        self.assert_docs_equal(schema2_prime, schema2)
开发者ID:kkrampa,项目名称:commcare-hq,代码行数:15,代码来源:test_schema.py

示例2: rebuild_schemas

# 需要导入模块: from couchexport.models import ExportSchema [as 别名]
# 或者: from couchexport.models.ExportSchema import get_all_checkpoints [as 别名]
def rebuild_schemas(index):
    """
    Resets the schema for all checkpoints to the latest version based off the
    current document structure. Returns the number of checkpoints updated.
    """
    db = ExportSchema.get_db()
    all_checkpoints = ExportSchema.get_all_checkpoints(index)
    config = ExportConfiguration(db, index, disable_checkpoints=True)
    latest = config.create_new_checkpoint()
    for cp in all_checkpoints:
        cp.schema = latest.schema
        cp.save()
    return len(all_checkpoints)
开发者ID:philipkaare,项目名称:commcare-hq,代码行数:15,代码来源:tasks.py

示例3: test_get_last

# 需要导入模块: from couchexport.models import ExportSchema [as 别名]
# 或者: from couchexport.models.ExportSchema import get_all_checkpoints [as 别名]
    def test_get_last(self):
        indices = ["a string", ["a", "list"]]
        save_args = get_safe_write_kwargs()

        for index in indices:
            self.addCleanup(
                lambda idx: [cp.delete() for cp in ExportSchema.get_all_checkpoints(idx)],
                index
            )

        for index in indices:
            self.assertEqual(None, ExportSchema.last(index))
            dt = datetime.utcnow()
            schema1 = ExportSchema(index=index, timestamp=dt)
            schema1.save(**save_args)
            self.assert_docs_equal(schema1, ExportSchema.last(index))
            schema2 = ExportSchema(index=index, timestamp=dt + timedelta(seconds=1))
            schema2.save(**save_args)
            self.assert_docs_equal(schema2, ExportSchema.last(index))
            schema3 = ExportSchema(index=index, timestamp=dt - timedelta(seconds=1))
            schema3.save(**save_args)
            # still schema2 (which has a later date than schema3)
            self.assert_docs_equal(schema2, ExportSchema.last(index))
开发者ID:kkrampa,项目名称:commcare-hq,代码行数:25,代码来源:test_schema.py


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