ADD tables to .env , add tables_env to exporter
parent
3d3a9696fd
commit
b90726df40
19
exporter.py
19
exporter.py
|
|
@ -47,6 +47,7 @@ def write_log_summary(table, inserted, skipped, errors, inserted_rows):
|
||||||
except Exception as log_db_error:
|
except Exception as log_db_error:
|
||||||
print(f"Fehler beim Schreiben der Tabellen-Zusammenfassung in logs: {log_db_error}")
|
print(f"Fehler beim Schreiben der Tabellen-Zusammenfassung in logs: {log_db_error}")
|
||||||
|
|
||||||
|
|
||||||
# Pfade und Verbindungen
|
# Pfade und Verbindungen
|
||||||
SDF_LOCAL_PFAD = os.getenv("SDF_LOCAL_PFAD")
|
SDF_LOCAL_PFAD = os.getenv("SDF_LOCAL_PFAD")
|
||||||
SDF_NAME = os.getenv("SDF_NAME")
|
SDF_NAME = os.getenv("SDF_NAME")
|
||||||
|
|
@ -65,11 +66,19 @@ if not mssql_connection_str:
|
||||||
mail.send_error_email(error_msg, process)
|
mail.send_error_email(error_msg, process)
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
tables = [
|
## Neue Varinate über .env
|
||||||
"Addressee", "ADR", "AxlesArchive", "CardEncoding", "Carrier", "Coeff", "Conveyer",
|
tables_env = os.getenv("TABLES", "")
|
||||||
"CustomerLDB", "Fields", "GeneralData", "PDR", "Plate", "Product", "RDR",
|
tables = [t.strip() for t in tables_env.split(",") if t.strip()]
|
||||||
"RDR_LDB_Weighing", "Reason", "Supplier", "Tare", "TxWeighing", "Weighing_LDB"
|
|
||||||
]
|
if not tables:
|
||||||
|
write_log("Hinweis: Keine Tabellen in der .env gefunden (Variable TABLES fehlt oder ist leer).")
|
||||||
|
|
||||||
|
## Alte Variante ohne .env
|
||||||
|
# tables = [
|
||||||
|
# "Addressee", "ADR", "AxlesArchive", "CardEncoding", "Carrier", "Coeff", "Conveyer",
|
||||||
|
# "CustomerLDB", "Fields", "GeneralData", "PDR", "Plate", "Product", "RDR",
|
||||||
|
# "RDR_LDB_Weighing", "Reason", "Supplier", "Tare", "TxWeighing", "Weighing_LDB"
|
||||||
|
# ]
|
||||||
|
|
||||||
def get_pk_columns(mssql_cursor, table_name):
|
def get_pk_columns(mssql_cursor, table_name):
|
||||||
pk_query = """
|
pk_query = """
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue