Skip to content

Commit

Permalink
fix: no hardcode diff dir
Browse files Browse the repository at this point in the history
  • Loading branch information
bearsyankees committed Dec 5, 2024
1 parent 3de2feb commit 0e3ab17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions ferry/database/sync_db_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0e3ab17

Please sign in to comment.