> ## Documentation Index
> Fetch the complete documentation index at: https://sequin.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Airtable Setup

> In 2 minutes, you will sync all your Airtable data to a Postgres database and can begin building on it with SQL or your favorite ORM

<Warning>
  **Pardon the mess**

  You are viewing docs related to an older version of Sequin. We're in the process of updating our provider-specific guides and will be done in a few weeks (May 2024). [Please click here](/docs/) to view the latest version of the docs.

  If you're interested in Airtable and want to learn more about what's changing, [send us a note](mailto:support@sequin.io).
</Warning>

## Add your Airtable base to Sequin[](#add-your-airtable-base-to-sequin "Direct link to Add your Airtable base to Sequin")

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

<img src="https://mintcdn.com/sequin/3H0rKJAg0ey1fqux/images/airtable_inventory_tracking-c756532621db69cc460c1b304a3d5939.png?fit=max&auto=format&n=3H0rKJAg0ey1fqux&q=85&s=fab7ed16c0f3c663655c8b4ca299615e" alt="Inventory Tracking base" width="1974" height="1290" data-path="images/airtable_inventory_tracking-c756532621db69cc460c1b304a3d5939.png" />

(*For this quickstart, we'll be using the [Inventory Tracking template](https://airtable.com/templates/local-business/expDrHGuyjSQlrKTq/inventory-tracking). Feel free to join along or use another great sample from the [Airtable Universe](https://airtable.com/universe)!*)

**Step 1:** Create a new account at [https://console.sequin.io/signup](https://console.sequin.io/signup).

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

**Step 3:** Connect us with your Airtable account.

**Step 4:** Select the **Airtable base** you want to sync.

**Step 5:** Select the destination **database** you want to sync your data to. If you don't have one ready, you can sync to a demo Sequin-hosted database for now.

**Step 6:** Click **Create**.

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

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 a minute to complete.

## Query your base using SQL[](#query-your-base-using-sql "Direct link to Query your base using SQL")

Connect to your database via [Sequin's Postgres Proxy](/docs/sql-writes), which lets you write to your synced tables as well as read them. We'll use [psql](https://www.postgresql.org/docs/current/app-psql.html) as an example in this setup guide, but you can use any SQL client that works with Postgres.

**Step 1:** Go to **Connection Instructions** on the Sequin console. Copy the `psql` command to connect to your database via the Proxy.

**Step 2:** Open your terminal, and paste the `psql` command. Press **Enter**. This will open a connection to your database so you can write your first query:

```
psql -d {your_connection_string_here}
psql (14.2, server 12.11)
Type "help" for help.

db7hea89oah3tas=>

```

**Step 3:** To get a sense of your schema, list all the tables you're syncing to your database by typing the command `\dt`:

```sql theme={null}
db7hea89oah3tas=> \dt

                   List of relations
 Schema |           Name            | Type  |  Owner
--------+---------------------------+-------+----------
 public | _sync_cdc                 | table | postgres
 public | manufacturers             | table | postgres
 public | product_inventory         | table | postgres
 public | purchase_orders           | table | postgres
 public | warehouse_locations       | table | postgres
(6 rows)

```

You'll see all the Airtable tables you selected when setting up your sync are now tables in your database. You'll also see some `_sync` tables which Sequin uses to manage your sync.

**Step 4**: Now, write your first query. You can start with a simple `select` to get your bearings:

```sql theme={null}
db7hea89oah3tas=> select count(*) from product_inventory;

 count
-------
    15
(1 row)

```

Now, pull the `id`, `product_name`, and `price` of one of the product inventory records for the next step:

```sql theme={null}
db7hea89oah3tas=> select id, product_name, price from product_inventory limit 1;

  id               | product_name         | price
-------------------+----------------------+------
 rec1AhWrQbnQLBIqB | The High Street      | 12000
(1 row)

```

Great, you can now use this `id` in the last step of this setup guide.

## Write back to Airtable[](#write-back-to-airtable "Direct link to Write back to Airtable")

To create, update, or delete objects in Airtable, you can `insert`, `update`, or `delete` rows in your Postgres database.

When you're connected to your database through the Sequin Proxy, the Proxy listens for changes. When you make a mutation, the Proxy applies the mutation to Airtable's API first. If the mutation succeeds, your database is updated as well. If it fails, your database mutation will be rolled back, and you'll receive a Postgres error.

In this example, you'll update the `product_inventory` in the prior step by giving them a new first and last name:

```sql theme={null}
update product_inventory
set product_name = 'Sequin Dress', price = '99999'
where id = '{{product_inventory_id}}'

```

This call will update the product name and price of that item in the product inventory. If the Postgres write returned without an error, that means the API write succeeded as well!

You can see over on Airtable that the record has updated.

**Step 3:** Now, confirm the change in your database. Go back to `psql` and check the product\_inventory you just updated:

```sql theme={null}
db7hea89oah3tas=> select product_name, price from product_inventory where id='{{product_inventory_id}}';

 product_name | price
--------------+----------
 Sequin Dress | 99999
(1 row)

```

Great, Airtable and your database were updated simultaneously.

## Next steps[](#next-steps "Direct link to Next steps")

Your Airtable tables are now available as fully readable and writeable tables in your database. You can query for all your data using SQL, and mutate data thanks to Sequin's Postgres Proxy. To build on this foundation, here are some next steps:

* [Setup your ORM](/docs/reads) to work with your synced tables.
* Edit the Airtable objects and properties you're syncing at any time.
* Create [views](https://www.postgresql.org/docs/current/tutorial-views.html) on your Airtable data to tailor your schema to your needs.
* Invite your team to your Sequin account and start building!

If you need assistance setting up your sync, just [send us a note](mailto:support@sequin.io). We're around and eager to help.
