Opening duckdb files in web shell isn't possible
Trying to query tables from a duckdb file database isn't possible in the Web Shell as the .open command doesn't actually connect to it.
Steps:
- Add file.duckdb with
.files add - Open it with
.open file.duckdb - The text
Connected to a local transient in-memory database.changes toConnected to a read-only remote database at: file.duckdb.
Expected tables are still not there to query. This can be verified by checking 0 rows returned from PRAGMA show_tables;. If we check PRAGMA database_list; the result implies it still uses the in memory database:
┌─────┬──────┬──────────┐
│ seq ┆ name ┆ file │
╞═════╪══════╪══════════╡
│ 0 ┆ main ┆ :memory: │
└─────┴──────┴──────────┘
As a bonus remark; I also noticed that it's possible to open any filename with the open command. For example, running .open doesnt-exist.duckdb will change the connection text to Connected to a read-only remote database at: doesnt-exist.duckdb.
Hi! Proper support for multiple databases landed in DuckDB 0.7 (https://duckdb.org/2023/02/13/announcing-duckdb-070.html#multi-database-support) and that would make implement this more trivial (and potentially make .open obsolete altogether).
In paricular ATTACH 'someDatabase.duckdb' is the SQL version of .open, and can also be chained with USE 'someDatabase.duckdb, and I just tested that works with live https://shell.duckdb.org.
This can stay open until we figure out this properly, but a workaround / a better workflow it's already present.