Skip to main content

Airtable Setup

info

We've closed our beta for Airtable. Join the waitlist and we'll notify you when we're ready.

In 2 minutes, you will sync all your Airtable data to a Postgres database and begin querying your base with SQL.

Add your Airtable base to Sequin

First, let's connect your Airtable base to Sequin:

Inventory Tracking base

(For this quickstart, we'll be using the Inventory Tracking template. Feel free to join along or use another great sample from the Airtable Universe!)

Step 1: Create a new account at https://app.sequin.io/signup.

Step 2: Select Airtable as the platform you want to sync.

Step 3: Provide us with your Airtable API key. Click the the Where do I find this? link if you need a little help finding your API key on your Airtable account page.

Add API Key

Step 4: Select the Airtable base you want to sync. By default, we'll sync all the tables:

Select base to sync

Step 5: Select the destination database you want to sync your data to. You can sync to a Sequin-hosted database or sync to your self-hosted database.

Select destination

Step 6: Click Create.

After you click Create, we'll immediately connect to Airtable and begin syncing with your base.

Sync complete

For most Airtable bases, the sync will complete in a couple seconds. For larger bases of around ~10,000 records, the sync might take around 30 seconds to complete.

Connect to your Postgres database

Now that your database is setup, you can connect to it.

Sequin provisioned you a Postgres database. You can connect to your database in all the ways you're used to. For this guide, we'll use TablePlus.

Step 1: Download and install TablePlus from https://tableplus.com/.

Step 2: Open TablePlus and click Create a new connection...

Step 3:Click the Import from URL button.

Step 4:Copy and paste the Connect URL from Sequin into the Connection URL in TablePlus then click Import.

Step 5: Then simply name your your TablePlus connection (we recommend reusing the name of your Airtable base) and click Create.

Connecting on TablePlus

Query your base using SQL

You'll now see your entire Airtable base represented in Postgres tables!

Note that we convert your table names to snake_case (i.e lowercase words delineated by an underscore). So what was Product Inventory in Airtable is now product_inventory in your database.

To start querying, click the SQL button and have at it. For instance:

SELECT sum(revenue) AS "Gross Revenue" FROM sales_orders;

Enter table names

(Optional) Writing to Airtable

You can now read from your Postgres database. But what about writes?

Sequin promotes a one-way data flow architecture. Data flows from Airtable to your Postgres database. Your code or SQL client then reads from the database. To mutate your data, you write to the Airtable API through Sequin. Those mutations are applied simultaneously to both your Airtable base and your Sequin database so that they show up in subsequent reads by your code or SQL client:

Diagram of using Sequin Proxy

To use the Sequin Proxy, you craft HTTP requests to the Airtable API like you normally would. Except, you prepend proxy.sequin.io/ to the beginning of the hostname.

For example, here's a request that creates a new sales order in the "Inventory Tracking" base:

curl -v -X POST https://proxy.sequin.io/api.airtable.com/v0/app▒▒▒▒▒▒▒▒▒/Sales%20Orders \
-H "Authorization: Bearer key▒▒▒▒▒▒▒▒▒" \
-H "Content-Type: application/json" \
--data '{
"records": [
{
"fields": {
"Date": "2021-04-17",
"Product": [
"rec5zFZu80EN0QyJT"
],
"Quantity": 4,
"Sale Platform": "🖥 Online"
}
}
]
}'

Note the request looks exactly the same as what you'd find in the Airtable API docs, except for the URL. The base of the URL is https://proxy.sequin.io/api.airtable.com instead of https://api.airtable.com. This sends the request through the Sequin Proxy so that mutations are applied immediately to your Postgres database as well as your Airtable base.

You can also easily use the Sequin Proxy with the Airtable.js client (airtable on npm). You just need to set the endpointUrl to https://proxy.sequin.io/api.airtable.com, like this:

var Airtable = require("airtable");
var base = new Airtable({
apiKey: "key▒▒▒▒▒▒▒▒▒",
endpointUrl: "https://proxy.sequin.io/api.airtable.com",
}).base("app▒▒▒▒▒▒▒▒▒");

You can now query all your Airtable data with full-fledged SQL: SELECT, JOIN, UNION and more. And because your data is in a Postgres database, you can connect to your data using a variety of tools and programming languages.

From here, check out our Cheat Sheet for quick tips on how to query your Airtable base in SQL.

Read our Query docs to learn more about how we make Airtable work with SQL.