taolib.testing.data_sync.pipeline.extractor#

MongoDB 数据提取器。

实现基于时间戳的增量/全量数据提取。

Attributes#

Classes#

MongoExtractor

MongoDB 数据提取器。

Module Contents#

taolib.testing.data_sync.pipeline.extractor.logger#
class taolib.testing.data_sync.pipeline.extractor.MongoExtractor(batch_size: int = 1000)#

MongoDB 数据提取器。

支持增量(基于时间戳)和全量两种提取模式。

_batch_size = 1000#
async extract(source_collection: motor.motor_asyncio.AsyncIOMotorCollection, checkpoint: taolib.testing.data_sync.models.checkpoint.SyncCheckpoint | None = None, filter_query: dict[str, Any] | None = None, batch_size: int | None = None) collections.abc.AsyncIterator[list[dict[str, Any]]]#

分批提取源数据。

参数:
  • source_collection -- 源集合

  • checkpoint -- 检查点(增量同步时使用)

  • filter_query -- 额外过滤条件

  • batch_size -- 批次大小(覆盖构造函数值)

生成器:

文档批次列表