Shillelagh adapter for querying Grist Documents.
Project description
shillelagh-gristapi
Shillelagh adapter for querying Grist Documents.
Command line usage
Configuration in ~/.config/shillelagh/shillelagh.yaml:
gristapi:
api_key: <replace-with-your-key>
server: <replace-with-your-server>
org_id: <replace-with-your-org-id>
- find your api_key in your profile settings,
- set server to your server url, e.g.
https://templates.getgrist.com, - find your org_id with the
orgsendpoint, e.g.curl -H "Authorization: Bearer <replace-with-your-apy-key> "<replace-with-your-server>/api/orgs/" | jq '.[]|.id'.
# List document ids
# https://support.getgrist.com/api/#tag/workspaces/operation/listWorkspaces
SELECT * FROM 'grist://';
# List table ids
# https://support.getgrist.com/api/#tag/tables/operation/listTables
SELECT * FROM 'grist://<replace-with-a-doc-id>';
# Fetch records
# https://support.getgrist.com/api/#tag/tables/operation/listTables
SELECT * FROM 'grist://<replace-with-a-doc-id>/<replace-with-a-table-id>';
Python usage
import os
from shillelagh.backends.apsw.db import connect
connection = connect(
":memory:",
adapter_kwargs={
"gristapi": {
"api_key": os.environ["GRIST_API_KEY"],
"server": os.environ["GRIST_SERVER"],
"org_id": os.environ["GRIST_ORG_ID"],
}
},
)
cursor = connection.cursor()
# List document ids
# https://support.getgrist.com/api/#tag/workspaces/operation/listWorkspaces
query_docs = "SELECT * FROM 'grist://';"
cursor.execute(query_docs).fetchall()
# List table ids
# https://support.getgrist.com/api/#tag/tables/operation/listTables
query_tables = "SELECT * FROM 'grist://<replace-with-a-doc-id>';"
cursor.execute(query_tables).fetchall()
# Fetch records
# https://support.getgrist.com/api/#tag/tables/operation/listTables
query = "SELECT * FROM 'grist://<replace-with-a-doc-id>/<replace-with-a-table-id>';"
cursor.execute(query).fetchall()
Superset usage
To make the shillelagh-gristapi plugin available, add the following to your requirements-local.txt file:
shillelagh
shillelagh-gristapi
SqlAlchemy URI
shillelagh+safe://
Engine parameters
{
"connect_args":
{
"adapters":
["gristapi"],
"adapter_kwargs":
{
"gristapi":{
"api_key": "<REPLACE_WITH_YOUR_API_KEY>",
"server": "<REPLACE_WITH_YOUR_SERVER_URL>",
"org_id": "<REPLACE_WITH_YOUR_ORD_ID>"
}
}
}
}
| SqlAlchemy URI | Engine parameters |
|---|---|
| SQL Lab |
|---|
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shillelagh_gristapi-0.0.9.tar.gz.
File metadata
- Download URL: shillelagh_gristapi-0.0.9.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa20b7492f0fe85c202346b2d7e89faa84dd36ba2ff71f1eb9a3823a80487031
|
|
| MD5 |
f2416cc9b8a08d7e242dc1ed834383ba
|
|
| BLAKE2b-256 |
30d2a9a93873095d9fea3e0d405f6844e88cea945e6a9954eb6b1de651b6fa52
|
File details
Details for the file shillelagh_gristapi-0.0.9-py3-none-any.whl.
File metadata
- Download URL: shillelagh_gristapi-0.0.9-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d73b5e5c184e36bd7251cc8226413e9bf04759eed319a351fabeefcbba0b2f38
|
|
| MD5 |
94006ecdd08349f2e11b3cc46c8820f6
|
|
| BLAKE2b-256 |
6ff3cb2de34ce7a865000d6a7f110deee624eef9b9931a0e1a27137cad4d230a
|