Connect to MySQL databases from Airplane tasks
The MySQL resource allows tasks to connect to a MySQL database. For a high level introduction to resources, see the Resources page.

Creating a MySQL Resource

To create a new MySQL resource, visit Resource settings for your team, click the "New" button, and select the MySQL resource type. Enter your connection details in the form:
Name should be a human-readable name for your resource. You'll use this name to later reference this resource in tasks.
Host should be the IP address or DNS name of your database. Unless you're connecting to this database behind a self-hosted agent (see Private Networking below), this should be the public IP address and/or the public DNS name of the database.

IP Whitelisting

If your database has restrictions on incoming network connections, you'll need to ensure the Airplane IP addresses are whitelisted:

Running Adhoc SQL Queries

Once you've set up a MySQL resource, you can run SQL queries from a session. You can try this be creating a new session (visiting this link will create one for you) and adding a SQL block. Output from queries are captured and displayed as a table:

Running SQL Tasks

You can use MySQL resources with (non-adhoc) SQL tasks. SQL tasks are similar to adhoc SQL queries, except you can define a structured query ahead of time and only allow users to specify limited parameters.
See the SQL task docs for details:

Private Networking

To connect to a database inside a private VPC, you can self-host the agent and run the agent within your own VPC. Since tasks and SQL queries run on agents, these tasks will run from within your network and be able to connect.
Last modified 4mo ago