From 3f61286cadf95a7b3a0a8bc9c457d330039661e5 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Tue, 10 Jan 2023 16:19:56 +0100 Subject: [PATCH] correct placement of warning --- tools/conv.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/conv.py b/tools/conv.py index a1c0699d..58cade5e 100644 --- a/tools/conv.py +++ b/tools/conv.py @@ -127,9 +127,6 @@ def migrate_db(file: str, schema: str, exclude_tables: List[str] = []): """ ).fetchall() - if len(tables) == 0: - print(f"⚠️ You sneaky dev! Schema {schema} is empty!") - for table in tables: tableName = table[0] print(f"Migrating table {tableName}") @@ -143,6 +140,10 @@ def migrate_db(file: str, schema: str, exclude_tables: List[str] = []): q = build_insert_query(schema, tableName, columns) data = sq.execute(f"SELECT * FROM {tableName};").fetchall() + + if len(data) == 0: + print(f"⚠️ You sneaky dev! Table {tableName} is empty!") + insert_to_pg(q, data) sq.close()