From 0e3ab176a466fc493e566813d0c5bf388dcf5f9c Mon Sep 17 00:00:00 2001 From: bearsyankees Date: Thu, 5 Dec 2024 02:06:55 +0000 Subject: [PATCH] fix: no hardcode diff dir --- ferry/database/sync_db_diff.py | 6 ++++-- main.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ferry/database/sync_db_diff.py b/ferry/database/sync_db_diff.py index 446dc674a..84eecd30a 100644 --- a/ferry/database/sync_db_diff.py +++ b/ferry/database/sync_db_diff.py @@ -261,7 +261,9 @@ def get_valid_columns(table_name, db_meta): return [col.name for col in table.columns] -def sync_db(tables: dict[str, pd.DataFrame], database_connect_string: str): +def sync_db( + tables: dict[str, pd.DataFrame], database_connect_string: str, data_dir: Path +): db = Database(database_connect_string) db_meta = MetaData() @@ -333,7 +335,7 @@ def get_valid_columns(table_name): print("Generating diff...") tables_old = get_tables_from_db(database_connect_string) - diff = generate_diff(tables_old, tables, "/workspaces/ferry/diff") + diff = generate_diff(tables_old, tables, str(data_dir / "diff")) conn = db.Engine.connect() inspector = inspect(db.Engine) diff --git a/main.py b/main.py index bfcafa6b7..000dde7c6 100644 --- a/main.py +++ b/main.py @@ -90,7 +90,7 @@ async def main(): if args.rewrite: sync_db_old(tables, args.database_connect_string) else: - sync_db(tables, args.database_connect_string) + sync_db(tables, args.database_connect_string, data_dir=args.data_dir) if args.generate_diagram: from ferry.generate_db_diagram import generate_db_diagram