Closed mskyttner closed 1 month ago
Great idea, will look into that! Thanks for reporting!
This feature has been enabled on Friday. Please check!
So nice! I noticed that I need to give the db file an extension of ".duckdb" for it to work. Initially I had a db file with extension .db and got this error message:
Error: {"exception_type":"Invalid Input","exception_message":"Error when sniffing file \"file-1725281264229-0icbc4a87dkj\".\nCSV options could not be auto-detected. Consider setting parser options manually.\n"}
at fa.insertCSVFromPath (bindings_base.ts:368:19)
at Ao.onMessage (worker_dispatcher.ts:375:36)
at Hc.globalThis.onmessage (duckdb-browser-eh.worker.ts:29:19)
index-Cm01Vfsl.js:60 Error: {"exception_type":"Invalid Input","exception_message":"Error when sniffing file \"file-1725281264229-0icbc4a87dkj\".\nCSV options could not be auto-detected. Consider setting parser options manually.\n"}
at JBe.onMessage (index-Cm01Vfsl.js:60:53527)
(anonymous) @ index-Cm01Vfsl.js:60
index-Cm01Vfsl.js:60 Error: {"exception_type":"Invalid Input","exception_message":"Error when sniffing file \"file-1725281264229-0icbc4a87dkj\".\nCSV options could not be auto-detected. Consider setting parser options manually.\n"}
at JBe.onMessage (index-Cm01Vfsl.js:60:53527)
(anonymous) @ index-Cm01Vfsl.js:60
index-Cm01Vfsl.js:1127 InsertFileError: Only CSV, Parquet, or Arrow files are supported
at index-Cm01Vfsl.js:60:83964
at Generator.throw (<anonymous>)
at s (index-Cm01Vfsl.js:60:78383)
When I changed the file extension to ".duckdb" it worked. In both firefox and chromium/thorium.
If I instead of using the drag'n'drop gesture attempt to attach to the same local database with ATTACH '/path/to/my/database.duckb' AS localdb (READ_ONLY)
, I get:
IO Error: The file "/path/to/my/database.duckb" exists, but it is not a valid DuckDB database file!
I get the same message at shell.duckdb.org...
It works fine to drag and drop it so I started to wonder how to make the ATTACH statment for a local file.... and the CLI doesn't complain with the same file path... so I think the error message is slightly misleading because it is a valid database file. Is this caused by something related to WASM filesystem etc?
If I instead of using the drag'n'drop gesture attempt to attach to the same local database with
ATTACH '/path/to/my/database.duckb' AS localdb (READ_ONLY)
, I get:IO Error: The file "/path/to/my/database.duckb" exists, but it is not a valid DuckDB database file!
That's not how this works, the browser has no direct access to the local filesystem. You have to "upload" it first to the virtual filesystem of DuckDB WASM.
Regarding the extension, it's true that it currently filters on the .duckdb
extension. I'll update it to also include .db
as well. Thanks for the heads-up.
The change has been deployed. Now you can use .duckdb
and .db
files via drag & drop.
Now that v1.0 has stabilized the file format...
The ability to drop a duckdb-file and have it attached and ready to be queried.
I think now it can be done using "ATTACH 'https://myserver/mydatabase.db' AS duckdb (READ_ONLY);" and then table names need to be prefigated in queries ie "FROM duckdb.my_table LIMIT 10".