Add MongoDB query utilities and update batch size for document insertion
This commit is contained in:
+21
-1
@@ -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)
|
||||
Reference in New Issue
Block a user