Shillelagh is a Python library and CLI tool that enables users to query various data sources, including APIs, files, and in-memory objects, using standard SQL. It implements the Python DB API 2.0 specification based on SQLite (using the APSW library) and also provides a SQLAlchemy dialect. The library is actively maintained with frequent releases, with the current version being 1.4.4.
pip install shillelaghVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to Shillelagh's DB API 2.0 interface and query a public Google Sheet using SQL. Shillelagh treats the external data source (like the Google Sheet URL) as a virtual table.
Upgrade your `apsw` package: `pip install --upgrade apsw`
Avoid including sensitive credentials directly in table names for production systems. Explore using environment variables or other secure configuration methods to pass credentials to adapters, or ensure strict control over query logging and exposure.
Upgrade to Shillelagh 1.4.4 or newer for improved date parsing error diagnostics: `pip install --upgrade shillelagh`.
Install the appropriate extra package for the driver using pip, such as `pip install shillelagh[http]` for HTTP sources or `pip install shillelagh[gsheets]` for Google Sheets.
Install `apsw` explicitly using pip: `pip install apsw`.
Verify the table name against the expected Shillelagh schema or data source, ensure the connection URI is correct, and confirm the data source is valid and accessible.
Ensure `shillelagh` is installed with its SQLAlchemy extras by running `pip install shillelagh[sqlalchemy]`.