ADD tables to .env , add tables_env to exporter

master
Sebastian Serfling 2025-10-29 09:40:53 +01:00
parent 3d3a9696fd
commit b90726df40
1 changed files with 14 additions and 5 deletions

View File

@ -47,6 +47,7 @@ def write_log_summary(table, inserted, skipped, errors, inserted_rows):
except Exception as log_db_error:
print(f"Fehler beim Schreiben der Tabellen-Zusammenfassung in logs: {log_db_error}")
# Pfade und Verbindungen
SDF_LOCAL_PFAD = os.getenv("SDF_LOCAL_PFAD")
SDF_NAME = os.getenv("SDF_NAME")
@ -65,11 +66,19 @@ if not mssql_connection_str:
mail.send_error_email(error_msg, process)
exit(1)
tables = [
"Addressee", "ADR", "AxlesArchive", "CardEncoding", "Carrier", "Coeff", "Conveyer",
"CustomerLDB", "Fields", "GeneralData", "PDR", "Plate", "Product", "RDR",
"RDR_LDB_Weighing", "Reason", "Supplier", "Tare", "TxWeighing", "Weighing_LDB"
]
## Neue Varinate über .env
tables_env = os.getenv("TABLES", "")
tables = [t.strip() for t in tables_env.split(",") if t.strip()]
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):
pk_query = """