Skip to content

simplify? #2

@ltalirz

Description

@ltalirz

## Get sqlite Names
conn.sql("USE __other")
tables = [i[0] for i in conn.sql("SHOW tables").fetchall()]
print(f"{len(tables)} tables found(s)")
conn.sql(f"USE {db_name}")
# Create tables
for table in tables:
print(f"Create duckdb table {table}")
conn.sql(f"CREATE TABLE {table} AS select * FROM __other.{table}")
conn.sql(f"DETACH __other")
conn.close()
end_time = time.perf_counter()
execution_time = (end_time - start_time) * 1000

This seems overly complicated. What about something like

# Attach the DuckDB database (named)
conn.execute(f"ATTACH '{duckdb_file}' AS duck_db;")
# Attach the SQLITE database (named)
conn.execute(f"ATTACH '{sqlite_db}' as sqlite_db;")

conn.execute("COPY FROM DATABASE sqlite_db TO duck_db;")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions