duckdb / sqlite_scanner

DuckDB extension to read and write to SQLite databases

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to attach sqllite database, empty error

adagrad opened this issue · comments

How could I bypass this error:

D LOAD 'extension/sqlite_scanner/sqlite_scanner.duckdb_extension';
Error: IO Error: Extension "extension/sqlite_scanner/sqlite_scanner.duckdb_extension" could not be loaded because its signature is either missing or invalid and unsigned extensions are disabled by configuration (allow_unsigned_extensions)
commented

For the shell you can pass the -unsigned flag at start-up, e.g.:

duckdb -unsigned

That works but leaves me with an empty error:

./duckdb -unsigned foo.duckdb
v0.4.1-dev1115 e95fb4c30
Enter ".help" for usage hints.
D LOAD 'extension/sqlite_scanner/sqlite_scanner.duckdb_extension';
D CALL sqlite_attach('/tmp/fin.quote.sqlite');
Error:
D

I'm having a similar issue following the path recommended by the docs/help (DuckDB 0.5.1) Same effect if I start the CLI with --unsigned or not:

v0.5.1 7c111322d
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D
D CALL sqlite_attach('/srv/sample-data.db');
Error: Catalog Error: Function with name sqlite_attach is not on the catalog, but it exists in the sqlite_scanner extension. To Install and Load the extension, run: INSTALL sqlite_scanner; LOAD sqlite_scanner;
D
D INSTALL sqlite_scanner;
D LOAD sqlite_scanner;
D
D CALL sqlite_attach('/srv/sample-data.db');
Error: Invalid Error:

Oddly, the sqlite_scanner extension shows up as installed, but not loaded, even after calling LOAD sqlite_scanner;:

D LOAD sqlite_scanner;
D select * From duckdb_extensions();
┌──────────────────┬────────┬───────────┬────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────┐
│  extension_name  │ loaded │ installed │                                    install_path                                    │                             description                              │
├──────────────────┼────────┼───────────┼────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
│ excel            │ true   │           │                                                                                    │                                                                      │
│ fts              │ true   │ true      │ (BUILT-IN)                                                                         │ Adds support for Full-Text Search Indexes                            │
│ httpfs           │ false  │ false     │                                                                                    │ Adds support for reading and writing files over a HTTP(S) connection │
│ icu              │ true   │ true      │ (BUILT-IN)                                                                         │ Adds support for time zones and collations using the ICU library     │
│ json             │ true   │ true      │ (BUILT-IN)                                                                         │ Adds support for JSON operations                                     │
│ parquet          │ true   │ true      │ (BUILT-IN)                                                                         │ Adds support for reading and writing parquet files                   │
│ postgres_scanner │ false  │ false     │                                                                                    │ Adds support for reading from a Postgres database                    │
│ sqlite_scanner   │ false  │ true      │ /home/username/.duckdb/extensions/v0.5.1/linux_amd64/sqlite_scanner.duckdb_exten... │ Adds support for reading SQLite database files                       │
│ tpcds            │ false  │ false     │                                                                                    │ Adds TPC-DS data generation and query support                        │
│ tpch             │ true   │ true      │ (BUILT-IN)                                                                         │ Adds TPC-H data generation and query support                         │
│ visualizer       │ true   │           │                                                                                    │                                                                      │
└──────────────────┴────────┴───────────┴────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────┘

Try wrapping it in single quotes when you install and load. Does that help?

install 'sqlite_scanner';
load 'sqlite_scanner';

@Alex-Monahan

Unfortuantely not. Same error:

v0.5.1 7c111322d
Enter ".help" for usage hints.
D
D
D install 'sqlite_scanner';
D load 'sqlite_scanner';
D
D
D select * From duckdb_extensions();
┌──────────────────┬────────┬───────────┬────────────────────────────────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────┐
│  extension_name  │ loaded │ installed │                                    install_path                                    │                             description                              │
├──────────────────┼────────┼───────────┼────────────────────────────────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────┤
│ excel            │ true   │           │                                                                                    │                                                                      │
│ fts              │ true   │ true      │ (BUILT-IN)                                                                         │ Adds support for Full-Text Search Indexes                            │
│ httpfs           │ false  │ false     │                                                                                    │ Adds support for reading and writing files over a HTTP(S) connection │
│ icu              │ true   │ true      │ (BUILT-IN)                                                                         │ Adds support for time zones and collations using the ICU library     │
│ json             │ true   │ true      │ (BUILT-IN)                                                                         │ Adds support for JSON operations                                     │
│ parquet          │ true   │ true      │ (BUILT-IN)                                                                         │ Adds support for reading and writing parquet files                   │
│ postgres_scanner │ false  │ false     │                                                                                    │ Adds support for reading from a Postgres database                    │
│ sqlite_scanner   │ false  │ true      │ /home/username/.duckdb/extensions/v0.5.1/linux_amd64/sqlite_scanner.duckdb_exten... │ Adds support for reading SQLite database files                       │
│ tpcds            │ false  │ false     │                                                                                    │ Adds TPC-DS data generation and query support                        │
│ tpch             │ true   │ true      │ (BUILT-IN)                                                                         │ Adds TPC-H data generation and query support                         │
│ visualizer       │ true   │           │                                                                                    │                                                                      │
└──────────────────┴────────┴───────────┴────────────────────────────────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────┘
D
D CALL sqlite_attach('/srv/sample-data.db');
Error: Invalid Error:

On mac arm64 (m1 pro), I got the same error that the extension was not available after running make:

./build/release duckdb -unsigned 
D LOAD 'build/release/extension/sqlite_scanner/sqlite_scanner.duckdb_extension';
================================================================================
IO Error: Extension "build/release/extension/sqlite_scanner/sqlite_scanner.duckdb_extension" not found

On mac arm64 (m1 pro), I got the same error that the extension was not available after running make:

./build/release duckdb -unsigned 
D LOAD 'build/release/extension/sqlite_scanner/sqlite_scanner.duckdb_extension';
================================================================================
IO Error: Extension "build/release/extension/sqlite_scanner/sqlite_scanner.duckdb_extension" not found

Does that file actually exist on disk?

Looks like this change was missed: #11

Try again with that change?

I was able to create the duckdb extension with #11. make test on mac arm64 now passes all the tests as well. Awesome! Thank you for the quick fix 🎉

Note that the tpch.db needs to be created before running the tests:

./build/release/duckdb < tpch-export.duckdb
sqlite3 tpch.db < tpch-create.sqlite

It looks like the root cause of this issue may be a symbol collision error (the copy of sqlite3 in the extension being overwritten by the sqlite_api_wrapper used by the DuckDB cli).

@adagrad and @bzbzbz are you able to confirm if the SQLite scanner functions as expected in another binding? Eg, JDBC, Python, node, etc

This should now be fixed in the latest DuckDB dev version