Skip to main content

Shillelagh adapter to query Grist documents and tables via SQL.

Project description

shillelagh-gristapi

A Shillelagh adapter that exposes the Grist REST API as SQL-queryable virtual tables via SQLite/SQLAlchemy.

Features

  • Query Grist documents, tables, and records with SQL
  • Filter pushdown for = and IN conditions; server-side ORDER BY and LIMIT
  • Discovery queries: list organizations, workspaces, documents, and tables via grist:// URIs
  • Column metadata introspection via grist://<doc_id>/<table_id>/__columns__
  • Built-in TTL caching (SQLite or in-memory) to reduce API calls
  • Enforces Grist access rules — your API key permissions apply automatically
  • Works with Apache Superset, the shillelagh CLI, and any SQLAlchemy-compatible tool

Installation

pip install shillelagh-gristapi

For the interactive CLI:

pip install 'shillelagh[console]'

For source installation, see docs/getting-started.md.

Quickstart

from shillelagh.backends.apsw.db import connect
import os

conn = connect(
    ":memory:",
    adapter_kwargs={"gristapi": {"grist_cfg": {
        "server": os.environ["GRIST_SERVER"],
        "org_id": int(os.environ["GRIST_ORG_ID"]),
        "api_key": os.environ["GRIST_API_KEY"],
    }}},
)
cursor = conn.cursor()
rows = cursor.execute('SELECT * FROM "grist://<DOC_ID>/<TABLE_ID>" LIMIT 10').fetchall()

Documentation

Document Description
docs/getting-started.md Prerequisites, install, step-by-step first queries
docs/uri-reference.md All grist:// URI patterns and their column schemas
docs/configuration.md CLI, Python, and Superset configuration reference
docs/type-mapping.md Grist column types to SQL/Shillelagh field mapping
docs/superset.md Apache Superset integration guide
docs/limitations.md Known restrictions and performance notes

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shillelagh_gristapi-0.2.0.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shillelagh_gristapi-0.2.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file shillelagh_gristapi-0.2.0.tar.gz.

File metadata

  • Download URL: shillelagh_gristapi-0.2.0.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for shillelagh_gristapi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a4b61190952d052fce5bd42e681a21219a5f65e33bcc9d5f6f8d13375fdebaf8
MD5 6f6dbb7aace1a4091924f3c3d516567a
BLAKE2b-256 c9dc2edda3dff9815443d9c478a117f4898265a5d16250ba3128dc671861ed35

See more details on using hashes here.

Provenance

The following attestation bundles were made for shillelagh_gristapi-0.2.0.tar.gz:

Publisher: pypi.yml on qleroy/shillelagh-gristapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file shillelagh_gristapi-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for shillelagh_gristapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e0e0108dc12487c42bc6fb78cc3e0cd72f40852a0d9758744c01fdda7cc37b1
MD5 b40204781c6d4d5a0b9b3f694824bb38
BLAKE2b-256 c8088793a8aa0941346d127f7fcf367a9ff21225b262726c2500142bddd095bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for shillelagh_gristapi-0.2.0-py3-none-any.whl:

Publisher: pypi.yml on qleroy/shillelagh-gristapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page