Skip to content
Snippets Groups Projects
Commit 6421a3f5 authored by mjbonifa's avatar mjbonifa
Browse files

(fix) removed export of sqlite_sequence. Closes #45

parent e683b6f1
Branches
No related tags found
No related merge requests found
......@@ -312,15 +312,17 @@ def export(map_path, export_path, version, omop_metadata):
# Get the list of all tables
cur.execute("SELECT name FROM sqlite_master WHERE type='table';")
tables = cur.fetchall() # List of tables
# Export each table to a separate CSV file
for table in tables:
table_name = table[0] # Extract table name
df = pd.read_sql_query(f"SELECT * FROM {table_name}", conn)
output_file = f"{table_name}.csv"
output_path = export_path / output_file
df.to_csv(output_path, index=False) # Save as CSV
logger.info(f"Exported {table_name} to {table_name}.csv")
table_name = table[0]
# ignore SQLite's internal system table
if table_name != "sqlite_sequence":
df = pd.read_sql_query(f"SELECT * FROM {table_name}", conn)
output_file = f"{table_name}.csv"
output_path = export_path / output_file
df.to_csv(output_path, index=False) # Save as CSV
logger.info(f"Exported {table_name} to {table_name}.csv")
conn.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment