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 Type | Postgres Type |
|---|---|
| Single line text, Long text, Email, URL, Phone | text |
| Number | numeric, integer, bigint, real, double precision |
| Currency, Percent | numeric |
| Autonumber | bigint |
| Single select | text |
| Multiple select | jsonb |
| Checkbox | boolean |
| Date | date |
| Created time, Last modified time | timestamp |
| Created by, Last modified by, User | jsonb |
| Multiple record links, Attachments, Lookup | jsonb |
Preparation
Before you get started, make sure the wrappers extension is installed on your database:
_10create extension if not exists wrappers with schema extensions;
and then create the foreign data wrapper:
_10create 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.
_10select 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:
_10create 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:
_10create 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
Third-party integrations and docs are managed by Supabase partners.