Setup a Sequin sync
Before you can use Sequin with Airplane, you’ll need to create a sync. Sequin will guide you through authenticating, selecting the data you want to sync, and connecting to your database. Read our getting started guide for step-by-step instructions.Create an Airplane resource
A resource in Airplane is a connection to a database or API. Sequin uses a Postgres Proxy to interface with your Sequin-synced tables. The Proxy lets Sequin capture inserts, updates, and deletes you make in your database and commit them to the API. To add Sequin’s Postgres Proxy as an Airplane resource, you can treat it as a regular Postgres resource and enter the connection details in the resource configuration: Step 1: Go to your Airplane dashboard and click the databases icon labeled “Resources.” Click the ”+” icon in the environment where you want to create the resource. Step 2: Select PostgreSQL. Step 3: This opens up the “Create new resource” slide-out. Give the connection a name (like “salesforce-sequin”) and paste the values for host, database name, database username, and database password from the Connection instructions tab of your Sequin dashboard.
Using the Postgres resource in Airplane
Now, Sequin is syncing your API data to Postgres. You’ve also connected Airplane to Postgres via Sequin’s Proxy. To query this data in your Airplane app, first create a new task: Step 1: Open the “File browser” by clicking the computer icon on the left rail. Click the ”+” button and select “Task.” Step 2: Select “SQL”, give the task a name, and click “Create.” This will create two files: the task definition (ending in.task.yaml
) and the SQL query associated with the task (ending in .sql
).
Step 3: Write your SQL query. For example, here’s a Salesforce query that finds all the Salesforce Contacts belonging to a given account:
:account_id
. You can bind a task parameter to :account_id
in the task definition:
account_id
as the argument. As a test, you can run a task at any time by selecting it in the file browser (tasks have the lightning bolt icon).
Once your tasks are ready, you can create React components that interface with them. You can create a new view from scratch by clicking the ”+” button in the file browser. Or you can start with one of Airplane’s many templates.
For example, to populate Airplane’s Table
React component with the results of a task, you set the table’s task
property to the slug of the task:
Writing back to the API
With Sequin, you can also make mutations via your database as well. Inserts, updates, and deletes you make to Sequin-synced tables are first applied to the API. If they pass validation, they’re committed to your database. To write your first mutation query, create another task. You can compose aninsert
query by populating values
with various input fields in your application. Assuming the task binds parameters such as :first_name
and :last_name
, here’s what inserting to a Salesforce Contact table would look like:
Form
component:
mutate
when the user clicks “Submit.” You can define your mutate
function at the top of the component:

Errors
When Sequin’s Proxy encounters an error trying to apply your mutation in the upstream API, the Proxy returns a standard Postgres error. You can setup your app to display this as an alert notification. If you’re using themutate
function, you can add an onError
callback like this:
