This release is a pre-release and may not be stable for production use.
airtable-db-api

A Python DB API 2.0 for Airtable
This module allows you to query Airtable using SQL. It exposes:
- a Python DB API 2.0 (per PEP 249)
- a SQLAlchemy Dialect (see also "Developing new Dialects")
- a Superset Engine Spec
SQLAlchemy support
This module provides a SQLAlchemy dialect.
from sqlalchemy.engine import create_engine
engine = create_engine(
'airtable://:keyXXXX@appYYY?peek_rows=10&tables=tableA&tables=tableB',
date_columns={"tableA": ["My Date Field"]},
)
Metadata
At various points we need to know:
- The list of Tables supported in the Base
- The list of columns (Fields) supported on a given Table
- The type information for each Field
As of now we solve 1) by passing in a list of Tables using the tables query parameter on the URL.
We solve 2) and 3) using some combination of the peek_rows query parameter specifying the number of rows to fetch from Airtable to guess Field types and a date_columns engine parameter to specify which columns should be parsed as Dates.
Alternatively, 1-3 could all be solved with a comprehensive base_metadata engine parameter that specifies the Tables and Fields. There are a number of ways to generate this, but one approach is scraping the Base's API docs page using a technique like this.
Further options are documented here
Development
Python
$ pip install -r requirements-dev.txt
pre-commit
$ pre-commit install
black
Can be run manually as:
black --target-version py37
Roadmap
- Support for Airtable's Metadata API
- Support passed in Airtable Metadata (w/ types)
- Cleanup configuration (passed as query param on URL vs engine parameters)
- Built in Metadata scraper (not using Metadata API)
- Caching of field type "peeking"
- Datetime support
- More comprehensive testing
Release files for sqlalchemy-airtable 0.0.1.dev3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqlalchemy-airtable-0.0.1.dev3.tar.gz | 14.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqlalchemy_airtable-0.0.1.dev3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.5 kB
Release files / sqlalchemy-airtable-0.0.1.dev3.tar.gz
| Download URL | sqlalchemy-airtable-0.0.1.dev3.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99fc5f58995a3ea5e5e460a4269f99f091e3726ea455ae11b2aa3a4efcccc06d
|
|
BLAKE2b-256 checksum How to use checksums |
5380146eb5f33dee69f4f2b02468336d5eee6ea4eafa4e73efd961597aef622e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.2
|
Release files / sqlalchemy_airtable-0.0.1.dev3-py3-none-any.whl
| Download URL | sqlalchemy_airtable-0.0.1.dev3-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d532238c529398ec922d275baa70f36007a2af8e40997a9467b984a7c29a56b9
|
|
BLAKE2b-256 checksum How to use checksums |
01714a62080a8ef119335d6401b0ae10ff78404262ba98531baf4cb8684d4e85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.10.2
|