How Shillelagh automatically registers adapters
mainShillelagh uses a transparent mechanism to handle virtual tables in SQLite. Instead of requiring users to manually register modules and create virtual tables, Shillelagh intercepts SQLError: no such table errors.
When you execute a query against a table name that doesn't exist (e.g., a URI like s3://bucket/path/to/file), Shillelagh:
- Parses the error to extract the table name.
- Iterates through all registered adapters to find one that
supportsthe table name. - If found, it automatically runs the
CREATE VIRTUAL TABLEcommand using arguments provided by the adapter'sparse_urimethod. - Re-runs your original query.
To the user, this means you can query remote data sources directly using SQL as if they were local tables.
-- You can query a remote resource directly without manual setup
SELECT * FROM "s3://bucket/path/to/file";