Mause/duckdb_engine

[Question]: Superset support | Attach is not persisted

Opened this issue · 1 comments

Hello Team,

We are trying to connect Superset instance to an in-memory duckdb which will in turn attach to a Postgres Instance.
Trying to attach a postgres database to duckdb works but is not persisted.
With an example, running the below 2 queries works fine and produces the result

ATTACH 'dbname=<dbname> user=<user> host=localhost password='' port=xxxx' AS test_db (TYPE POSTGRES, READ_ONLY);
select * from test_db.public.test

However, if we execute one after the other, the second query gives an error

duckdb error: Binder Error: Catalog "test_db" does not exist!

How can we make this attach variable to persist across queries or is this an incorrect way of handling ?

The Database connection of duckdb uses an in-memory url
duckdb:///:memory:

Any help is appreciated.

Thank you

Yeah my guess is a new in-memory duckdb connection is created each time a query is executed. You'd need to configure attachments in the duckdb connect args (#1106) for this to work in Superset.

Otherwise, you'll have to run the ATTACH command at the beginning of every SQL query you run from Superset.