Airtable
Connect & Ingest data from Airtable
Airtable is a cloud-based platform that combines the simplicity of a spreadsheet with the power of a database. The Sling Airtable connector automatically discovers all accessible bases and tables, creating a dynamic endpoint for each table.
CLI Pro Required: APIs require a CLI Pro token or Platform Plan.
Setup
The following credentials and inputs are accepted:
Secrets:
api_key(required) -> Your Airtable Personal Access Token
Inputs (optional):
last_modified_field_map(optional) -> A nested map of base names to table names to the field name containing the last modified timestamp. Used for incremental sync.
Getting Your API Key
Click "Create new token"
Give your token a name (e.g., "Sling Integration")
Add the following scopes:
data.records:read- To read records from tablesschema.bases:read- To discover bases and tables
Add access to the bases you want to sync (or all bases)
Click "Create token" and copy the token (it starts with
pat)
Using sling conns
sling connsHere are examples of setting a connection named AIRTABLE. We must provide the type=api property:
sling conns set AIRTABLE type=api spec=airtable secrets='{ api_key: patXXXXXXXXXXXXXX }'Environment Variable
export AIRTABLE='{ type: api, spec: airtable, secrets: { api_key: "patXXXXXXXXXXXXXX" } }'Sling Env File YAML
See here to learn more about the sling env.yaml file.
connections:
AIRTABLE:
type: api
spec: airtable
secrets:
api_key: "patXXXXXXXXXXXXXX"With incremental sync configuration:
connections:
AIRTABLE:
type: api
spec: airtable
secrets:
api_key: "patXXXXXXXXXXXXXX"
inputs:
last_modified_field_map:
'My Base Name':
'My Table Name': 'Updated At'
'Another Base':
'Customers': 'Last Modified'
'Orders': 'Modified Time'Replication
Here's an example replication configuration to sync Airtable tables to a PostgreSQL database:
source: AIRTABLE
target: MY_POSTGRES
defaults:
mode: full-refresh
object: public.{stream_table}
streams:
# sync all tables in all bases
'*':
# exclude a specific table
sales_crm_contacts:
disabled: TrueThis replication syncs all Airtable tables to PostgreSQL using full-refresh mode, except for sales_crm_contacts which is disabled.
Dynamic Endpoints
The Airtable connector uses dynamic endpoint discovery. When you connect, Sling automatically:
Fetches all accessible bases
For each base, fetches all tables
Creates an endpoint for each table named
{base_name}_{table_name}in snake_case
For example, if you have a base called "Sales CRM" with tables "Contacts" and "Deals", Sling creates:
sales_crm_contactssales_crm_deals
To discover available endpoints:
sling conns discover AIRTABLEEach record includes the following metadata fields in addition to your table columns:
_id- The Airtable record ID_created_time- When the record was created_base_id- The Airtable base ID_base_name- The base name_table_id- The Airtable table ID_table_name- The table name
Incremental Sync
To enable incremental sync for a table, you must specify which field contains the "last modified" timestamp using the last_modified_field_map input.
Example env.yaml with incremental sync:
connections:
AIRTABLE:
type: api
spec: airtable
secrets:
api_key: "patXXXXXXXXXXXXXX"
inputs:
last_modified_field_map:
'Data Catalog':
'Datasets': 'Updated At'Example replication with incremental mode:
source: AIRTABLE
target: MY_POSTGRES
defaults:
mode: incremental
streams:
data_catalog_datasets:
object: public.airtable_datasetsIf you are facing issues connecting, please reach out to us at [email protected], on discord or open a Github Issue here.
Last updated
Was this helpful?