taolib.testing.data_sync.pipeline.loader

taolib.testing.data_sync.pipeline.loader#

MongoDB 数据加载器。

实现批量 upsert 操作。

Attributes#

Classes#

MongoLoader

MongoDB 数据加载器。

Module Contents#

taolib.testing.data_sync.pipeline.loader.logger#
class taolib.testing.data_sync.pipeline.loader.MongoLoader#

MongoDB 数据加载器。

使用 bulk_write + ReplaceOne(upsert=True) 实现高效加载。

async load(target_collection: motor.motor_asyncio.AsyncIOMotorCollection, documents: list[dict[str, Any]]) taolib.testing.data_sync.pipeline.protocols.LoadResult#

批量加载文档到目标集合。

参数:
  • target_collection -- 目标集合

  • documents -- 文档列表

返回:

加载结果