Refactor MongoDB to PostgreSQL data synchronization: remove json2postgres.py, add mongodb2postgres.py for improved schema generation and data insertion

This commit is contained in:
2026-02-06 12:11:46 -05:00
parent a52bd5571e
commit 9fbd5dc8b9
4 changed files with 781 additions and 294 deletions
+7 -7
View File
@@ -114,13 +114,13 @@ class settype(object):
)
currentDir = os.path.dirname(os.path.abspath(__file__))
currentDir = os.path.dirname(currentDir)
ddl_file_path = f"{currentDir}/db/ddl/recreate_updates_schema.sql"
with open(ddl_file_path, "r") as file:
sql = file.read()
file
with engine.connect() as conn:
with conn as cursor:
cursor.execute(text(sql))
# ddl_file_path = f"{currentDir}/db/ddl/recreate_updates_schema.sql"
# with open(ddl_file_path, "r") as file:
# sql = file.read()
# file
# with engine.connect() as conn:
# with conn as cursor:
# cursor.execute(text(sql))
updatesBase.prepare(engine, reflect=True, schema="updates")
dboBase.prepare(engine, reflect=True, schema="dbo")
metadata = sqlalchemy.MetaData(schema="updates")