Destinations
Connect MySQL as a destination
Create a MySQL service account and connect MySQL to an Artie pipeline. Artie writes to one destination database, or to one database per source schema.
Required settings
Artie asks for these connection values. Each field name matches its label in the Artie dashboard.
| Field | Default | What to enter |
|---|---|---|
| Host | None | The IP address or host name of your MySQL server, for example server.example.com. |
| Port | 3306 | The port MySQL listens on. |
| Authentication method | Static credentials | Static credentials to sign in with a password. Role assumption to sign in with an IAM role, on Amazon RDS and Aurora. |
| User | None | The service account user, artie in the service account script. |
| Password | None | The service account password. Required with Static credentials. |
| TLS mode | Disabled | Disabled, TLS (preferred) or TLS (required). TLS (preferred) uses TLS when available and falls back to an unencrypted connection. |
Create a service account
In the Dashboard, pick the Authentication method that matches how the user signs in.
CREATE USER 'artie' IDENTIFIED BY 'password';
-- Allows Artie to merge data, create and alter destination tables, and clean up
-- its temporary tables.
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON *.* TO 'artie';Replace password with the password for the user.
Amazon RDS and Aurora only. Artie signs in with an RDS IAM authentication token instead of a password:
CREATE USER 'artie' IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS';
-- Allows Artie to merge data, create and alter destination tables, and clean up
-- its temporary tables.
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON *.* TO 'artie';Then enable IAM database authentication, create the role, and configure the connector as described in Set up role assumption. The steps are the same for a destination.
In the Dashboard, role assumption adds AWS role ARN, AWS region and AWS external ID (optional). It requires TLS, so Disabled leaves the TLS mode list once you enter a role ARN.
Role assumption isn’t supported over PrivateLink. Use static credentials on a PrivateLink connection.
Add MySQL to a pipeline
Run the service account script first: the setup has no Prepare destination step for MySQL. When you create a pipeline, the Destination section of the setup has these steps.
Choose the destination
In Choose destination, select MySQL.
Choose how Artie reaches MySQL
In Network access, choose how Artie reaches the database, for example an IP allowlist or an SSH tunnel.
Artie skips this step when the pipeline reuses an existing MySQL connector.
Enter the connection details
In Connect and verify, enter the fields from Required settings.
Choose the destination database
In Schema name, select the database Artie writes to.
If your source has schemas, a Schema control appears first with One schema and Multiple schemas. Multiple schemas replaces Schema name with Schema name prefix (optional). Destination database routing describes both.
Verify the destination
Select Verify destination. Artie shows “Destination verified”.
If the pipeline has no tables yet, the button reads Test connection. A passing test shows “Connection works. Choose tables to finish verifying the destination.”
To change these settings on an existing pipeline, select Edit pipeline, then open the Destination: MySQL tab. Pause the pipeline first: the database settings are locked while it runs. After you change the database, move the pipeline’s tables to it in MySQL.
Destination database routing
In MySQL, schemas and databases are the same thing, so the Dashboard’s schema settings choose the destination database. When your source has schemas, choose where each replicated table goes:
| Setup label | Label on an existing pipeline | Result |
|---|---|---|
| One schema | Write to one schema | Every table goes to the database in Schema name. |
| Multiple schemas | Write to multiple schemas | Each table goes to a database named after its source schema. |
When your source has no schemas, Artie writes every table to the database in Schema name.
Write to one schema
Select One schema and choose the destination database in Schema name. Artie writes every selected source table to that database, regardless of its source database.
A table from a source schema other than the pipeline’s default takes its schema as a prefix: accounting.actions becomes accounting_actions. See Destination table naming.
Select an existing database, or create one: type its name in Schema name and select Create “NAME”, where NAME is the name you typed. Artie runs CREATE DATABASE IF NOT EXISTS with the destination service account. The global grant in the service account script includes the required CREATE privilege.
For an existing database, the service account needs SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, and ALTER on that database. If you prefer a database-scoped grant for an existing database, use:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER
ON artie_replica.* TO 'artie';To create a database with a database-scoped grant, grant on its name before you create it. MySQL accepts grants on a database that doesn’t exist yet, and CREATE on that database is enough to create it:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER
ON NEW_DATABASE.* TO 'artie';Replace NEW_DATABASE with the name you type in Schema name.
In a database grant, _ and % are wildcards, so an unescaped name also matches similar names: NEW_DATABASE matches NEWXDATABASE too. To match one name exactly, wrap it in backticks and escape the wildcards, for example ON `new\_database`.*. A name with a hyphen also needs backticks.
Write to multiple schemas
Select Multiple schemas to preserve each source database as a separate destination database. Artie writes a table from each source database to the corresponding destination database. To prefix every destination database name, set Schema name prefix (optional).
For example, a source table in orders.events is written to orders.events, or to replica_orders.events when the prefix is replica_.
Turn on Create missing schemas and Artie creates each missing destination database when the pipeline deploys, which needs CREATE on each new database: the global grant, or a grant on each database name made before the pipeline deploys. On an existing pipeline, the setting reads Dynamically create namespaces. Otherwise, create every destination database before starting the pipeline, or verification fails on the missing ones. Artie creates and evolves tables within those databases. The service account needs the same table-management permissions on every destination database:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER
ON orders.* TO 'artie';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER
ON replica_orders.* TO 'artie';What Artie creates
Artie creates each destination table that doesn’t exist. Destination table names can be up to 64 characters.
For a batch of inserts and updates, Artie writes straight to the destination table with INSERT ... ON DUPLICATE KEY UPDATE. Three kinds of batch go through a temporary staging table first: batches with deletes, batches for tables with soft deletes, and batches with TOAST columns.
Staging tables are named __artie_SUFFIX_EXPIRY. SUFFIX is 5 random characters, and EXPIRY is a Unix timestamp 6 hours after creation. Artie drops them, which is why the service account needs DROP.
Data types
Artie creates columns with these MySQL types. Artie’s typing library covers how source types become Artie types.
When the source is also MySQL, Artie creates each column with its source column type instead. It uses this table for ENUM and SET columns, for source types it doesn’t map (such as spatial types), for a string primary key with no length or a length over 255, and for a column with no source type.
| Artie type | MySQL type |
|---|---|
| Integer | BIGINT |
| Float, double | DOUBLE |
| Decimal with precision up to 65 and scale up to 30 | DECIMAL(precision, scale) |
| Decimal with no precision | DECIMAL(65, 5) |
| Decimal with a higher precision or scale | TEXT |
| Boolean | BOOLEAN |
| String, UUID | TEXT, or VARCHAR(255) for a primary key column |
| Struct, JSON, array | JSON |
| Date | DATE |
| Time | TIME(6) |
| Timestamp, with or without a time zone | DATETIME(6) |
| Interval | TEXT |
Was this page helpful?
- Need help? Message us on Slack or email [email protected].
- Want a walkthrough? Book a demo.
- LLM? Read llms.txt.