Airtable
Airtable is an easy-to-use online platform for creating and sharing relational databases.
The Airtable Wrapper allows you to read data from your Airtable bases/tables within your Postgres database.
Warning
Restoring a logical backup of a database with a materialized view using a foreign table can fail. For this reason, either do not use foreign tables in materialized views or use them in databases with physical backups enabled.
Preparation
Before you get started, make sure the wrappers
extension is installed on your database:
1 |
|
and then create the foreign data wrapper:
1 2 3 |
|
Secure your credentials (optional)
By default, Postgres stores FDW credentials inide 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.
1 2 3 4 5 6 7 |
|
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:
1 2 3 4 5 |
|
1 2 3 4 5 |
|
Creating Foreign Tables
The Airtable Wrapper supports data reads from the Airtable API.
Records
The Airtable Wrapper supports data reads from Airtable's Records endpoint (read only).
Operations
Airtable | Select | Insert | Update | Delete | Truncate |
---|---|---|---|---|---|
Records | ✅ | ❌ | ❌ | ❌ | ❌ |
Usage
1 2 3 4 5 6 7 8 9 |
|
Options
The full list of foreign table options are below:
base_id
- Airtable Base ID the table belongs to, required.table_id
- Airtable table ID, required.view_id
- Airtable view ID, optional.
Query Pushdown Support
This FDW doesn't support query pushdown.
Examples
Some examples on how to use Airtable foreign tables.
Query an Airtable table
This will create a "foreign table" inside your Postgres database called airtable_table
:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
You can now fetch your Airtable data from within your Postgres database:
1 |
|
Query an Airtable view
We can also create a foreign table from an Airtable View called airtable_view
:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
You can now fetch your Airtable data from within your Postgres database:
1 |
|