Add MongoDB query utilities and update batch size for document insertion

This commit is contained in:
2026-02-06 14:49:56 -05:00
parent 1283bd282a
commit 8ed2a77365
5 changed files with 406 additions and 4 deletions
+21 -1
View File
@@ -73,7 +73,7 @@ for tableName in tableNames:
inserter = MongoDocumentInserter(batch_size=1000)
inserter = MongoDocumentInserter(batch_size=10000)
# Map table names to their MongoDB collections and primary keys
collection_map = {
@@ -118,3 +118,23 @@ for tableName in tableNames:
# if __name__ == "__main__":
# sys.exit(main())
# Below are the relevant methods from db/functions.py and db/query_utils.py that are used in the above code. They are included here for completeness and context.
# Needs to be incorporated into logic so that only releveant documents are updated.
# from db.query_utils import MongoQueryUtils
# # With additional filters
# recent = MongoQueryUtils.get_recent_updates(
# collection=mongo_updater.mgseries,
# minutes=60,
# updated_field='updated',
# query_filter={'status': 'Ended'}, # Only ended shows
# )
# # Since a specific timestamp
# docs = MongoQueryUtils.get_updates_since(
# collection=mongo_updater.mgseries,
# since_timestamp=None, # Epoch or ISO string
# )
# for doc in docs:
# print(doc)