Back
Airtable Wrapper

Airtable Wrapper

Overview

Airtable Wrapper

Airtable is an AI-native app platform that combines the flexibility of a spreadsheet with the structure of a relational database. Teams use it to build collaborative apps, manage workflows, and organize operational data across marketing, product, and project management.

The Airtable Wrapper brings your bases and tables into Postgres as queryable foreign tables. Query records with plain SQL, target specific views, and join Airtable data against your application data. It is read-only and works with Supabase Vault for secure API key management.

Supported Data Types

Airtable Field TypePostgres Type
Single line text, Long text, Email, URL, Phonetext
Numbernumeric, integer, bigint, real, double precision
Currency, Percentnumeric
Autonumberbigint
Single selecttext
Multiple selectjsonb
Checkboxboolean
Datedate
Created time, Last modified timetimestamp
Created by, Last modified by, Userjsonb
Multiple record links, Attachments, Lookupjsonb

Preparation

Before you get started, make sure the wrappers extension is installed on your database:


_10
create extension if not exists wrappers with schema extensions;

and then create the foreign data wrapper:


_10
create foreign data wrapper airtable_wrapper
_10
handler airtable_fdw_handler
_10
validator airtable_fdw_validator;

Secure your credentials (optional)

By default, Postgres stores FDW credentials inside pg_catalog.pg_foreign_server in plain text. Anyone with access to this table will be able to view these credentials. Wrappers is designed to work with Vault, which provides an additional level of security for storing credentials. We recommend using Vault to store your credentials.

Get your token from Airtable's developer portal.


_10
select vault.create_secret(
_10
'<Airtable API key or Personal Access Token>',
_10
'airtable',
_10
'Airtable API key for Wrappers'
_10
);

Connecting to Airtable

We need to provide Postgres with the credentials to connect to Airtable, and any additional options. We can do this using the create server command:

With Vault:


_10
create server airtable_server
_10
foreign data wrapper airtable_wrapper
_10
options (
_10
api_key_id '<key_ID>' -- The Key ID from above.
_10
);

Without Vault:


_10
create server airtable_server
_10
foreign data wrapper airtable_wrapper
_10
options (
_10
api_key '<your_api_key>'
_10
);

Foreign table options

Each foreign table requires base_id and table_id, both found in your table's URL. An optional view_id can be specified to query a specific Airtable view.

Resources

Details

DeveloperSupabase
DocumentationLearn

Third-party integrations and docs are managed by Supabase partners.

Get started with Airtable Wrapper and Supabase.