-
Hello, I am trying to import tables from an sqlite file directly into a duckdb database, without attaching it completely. Ideally, I would like to run a raw duckdb query to import it, but the table is just not showing up in the table list afterwards. con = ibis.duckdb.connect()
cur = con.raw_sql("CREATE TABLE tbl AS FROM sqlite_scan('<sqlite_path>', '<table>')")
cur.close() finishes without any complaints, but then con.list_tables() throws a Do I need to commit the raw_sql call somehow? I'm on ibis 7.0.0 and duckdb 0.9.2. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 11 replies
-
You can do con = ibis.duckdb.connect()
table = con.read_sqlite("/path/to/sqlite.db", "table_name") and that should handle it. Is the query you ran like the one above? |
Beta Was this translation helpful? Give feedback.
-
This is a rough edge when running raw SQL: you only need to close the cursor for Since you're running a Your code should work, without leaking resources, if you remove the I think are two things we can do here:
|
Beta Was this translation helpful? Give feedback.
You can do
and that should handle it. Is the query you ran like the one above?
raw_sql
should work fine (but Ibis will handle the transaction stuff if you use the built-in methods). I ask because your example above appears to be missing aSELECT
.