Run SQL queries directly on Airtable bases, without copying data into an RDBMS first!
You can use stoke/airquery:
docker run --rm stoke/airquery
This repository includes a flake, just run:
nix run github:SirStoke/airquery
Requirements:
Then, you can run airquery
like so:
airquery -k <PERSONAL_ACCESS_TOKEN> -b <BASE_ID> <query>
The underlying base can be accessed under airtable.airtable.<lowercase-base-name>
. E.g.
airquery -k <PERSONAL_ACCESS_TOKEN> -b <BASE_ID> 'SELECT * FROM airtable.airtable.transactions'
For more advanced usage, just follow airquery --help
(cargo run -- --help
from the source).
Under the hood, airquery uses datafusion as its SQL engine. You can check out their SQL Reference to know which features are supported.
-
Support basic airtable types
- singleLineText / singleSelect / phoneNumber / email
- currency / number / percent
- date
- dateTime
- checkbox (treated as number, either 0 or 1. No support for native booleans in datafusion)
-
Support advanced airtable types
- duration
- formula
- lookup
- multiple select
- long text / rich text
-
SQL engine
- Basic SQL support
- Filters pushdown
- Sorting pushdown
-
Basic CLI
- JSON output
- Prettified tables
-
WASM support
- Can run inside an airtable script