Code: Select all
a = win32com.client.Dispatch("Access.Application")
a.OpenCurrentDatabase(db_path)
table_list = []
for table_info in cursor.tables(tableType='TABLE'):
table_list.append(table_info.table_name)
print (table_list)
for table in table_list:
logging.info(f"Exporting: {table}")
acExport = 1
acTable = 0
a.DoCmd.TransferDatabase(
acExport,
"ODBC Database",
"ODBC;DSN=PostgreSQL30;"
f"DATABASE={db_name};"
f"UID={pg_user};"
f"PWD={pg_pwd};"
f"Schema=Commercial;",
acTable,
f"{table}",
f"{table.lower()}"
)
logging.info(f"Finished Export of Table: {table}")
logging.info("Creating empty table in EGDB based off of this")
Vielen Dank