Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Engine Spec for Airtable #12

Merged
merged 4 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[run]
omit =
setup.py
# We don't test this as we don't have Superset
airtabledb/db_engine_specs.py

[report]
exclude_lines =
Expand Down
17 changes: 17 additions & 0 deletions airtabledb/db_engine_specs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Taken from: https://github.com/apache/superset/blob/master/superset/db_engine_specs/gsheets.py # noqa: E501
from superset.db_engine_specs.sqlite import SqliteEngineSpec


class AirtableEngineSpec(SqliteEngineSpec):
"""Engine for Airtable tables"""

engine = "airtable"
engine_name = "Airtable"
allows_joins = True
allows_subqueries = True

default_driver = "apsw"
sqlalchemy_uri_placeholder = "airtable://"

# TODO(cancan101): figure out what other spec items make sense here
# See: https://preset.io/blog/building-database-connector/
6 changes: 5 additions & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
[mypy]
exclude = build/
exclude = (?x)(
^build/$
# Can't type check as we don't install Superset:
| ^airtabledb/db_engine_specs\.py$
)

plugins = sqlalchemy.ext.mypy.plugin
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
"shillelagh.adapter": [
"airtable = airtabledb.adapter:AirtableAdapter",
],
"superset.db_engine_specs": [
"airtable = airtabledb.db_engine_specs:AirtableEngineSpec"
],
},
install_requires=(
"pyairtable",
Expand Down