Overview
This guide will show you how to get started with Sequin. Weâll walk through the full life cycle of an integration: setting up a new sync, reading and writing data, changing your schema, and moving your sync from development to production. In the next several minutes, youâll build an integration with Airtable. Youâll be able to build the integration using just SQL, and without needing to consider the underlying APIâs limitations or rate limits. For this example, imagine your application needs to store all inventory data in Airtable so your company can easily manage and fulfill orders. You can setup a free Airtable account and add this Inventory Tracking template to your workspace to follow along.Create a sync
To get started, youâll need a Sequin account. If you donât have one, you can sign up for free. Once youâre logged in, youâll be taken to the Sequin Console:
- After selecting Airtable as your source, complete the authentication flow to connect your Airtable account to Sequin.
- Select the Airtable base you want to sync, in this case the âInventory Trackingâ template.
- Configure your schema by selecting the tables you want to sync. For now, select the
Product Inventory
table. You can change the tables and columns included in your sync at any time - weâll cover that later. - To get started, for the destination you can select a pre-configured, Sequin-hosted database. Youâll promote this sync to a database of your choice - perhaps your production database - later.
- After you click âCreateâ, Sequin will begin syncing your data. You can view the status of your sync in the Sequin Console.
Connect to your database
Now that youâve created a sync, you can connect to your database and start building your integration. Youâll connect to your database just like any other Postgres database.- Youâll find your connection credentials on the Connection instructions tab of your sync:\
- Use the connection URL or the individual host, port, user, password, and database credentials to connect your database to your SQL client, ORM, or application.
Selecting records
With your database connected, you can start reading and writing data. Get your bearings by selecting all the records from theproduct_inventory
table:
record_id
for each record is stored in the id
column. Run another query to see which product has the most inventory:
where
to filter records. For example, to find all products that cost more than $100:
Adding new tables and columns
To make this a bit more interesting, letâs explore ajoin
by adding another table to your sync.
You can add new tables and columns to your sync at any time. Sequin will automatically create the table and columns in your database and keep them in sync with your source.
- Go back to the Sequin Console and navigate to the Mapping tab of your sync.
- Select the
Manufacturers
table to include it in your sync. - Now, edit the columns included in your sync. Perhaps you donât want to include any PII in your database. You can exclude columns from your database by clicking the pencil button and deselecting the columns you donât want to include - like email, phone number, and address:\
manufacturers
table. When the migration completes, youâll see a new backfill job in the Sequin Console. This backfill job will backfill all the records from the manufacturers
table into your database.
Now, when you connect to your database, youâll see two tables. You can query across these tables with a join
:
Insert, update, and delete records
Now that youâre familiar with your database schema, write some data back to your source. You can insert, update, and delete records in your source using SQL. Add a new product to your inventory:Errors
Sequin treats the API youâre syncing from as the source of truth. The business logic defined in Airtable is enforced on your database. For example, if you try to insert a record with an invalidtype
, youâll get an error:
Ship to production
Youâve built your integration and tested it in your your development environment using a Sequin-hosted database. Now you can point your sync to your production database and ship your integration. To do so, update your syncâs destination.- Go back to the Sequin Console and navigate to the Settings tab of your sync.
- Scroll down to the Destination section and click Edit.
- Select Launch or Connect, click the Connect button, and follow the steps for connecting an external database.
Cross schema queries
With your inventory data in your production database, you can now query across your entire database. For example, you can join your inventory data with yourusers
table to see which products each user has purchased: