Skip to main content

Overview

Write data to MySQL databases with automatic table creation and upsert support.

Configuration

sinks:
  my_mysql_sink:
    type: mysql_sink
    from: my_transform
    schema: my_schema
    table: my_table
    secret_name: MY_MYSQL_SECRET
    primary_key: id # Optional - for upsert behavior

Parameters

type
string
required
Must be mysql
from
string
required
The transform or source to read data from
schema
string
required
MySQL schema name
table
string
required
Table name to write to. Will be created automatically if it doesn’t exist.
secret_name
string
required
Name of the secret containing the MySQL connection string
primary_key
string
Optional. Column to use for upserts. If specified, existing rows will be updated instead of inserted.

Secret format

The secret should contain a MySQL connection string:
mysql://username:password@host:port/database
Create it with:
goldsky secret create MY_MYSQL_SECRET

Features

  • Auto table creation: Tables are created automatically based on your data schema
  • Upsert support: Use primary_key to update existing rows
  • Type handling: Automatic type conversion from Arrow to MySQL types

Example

sinks:
  mysql_transfers:
    type: mysql_sink
    from: filtered_transfers
    schema: public
    table: erc20_transfers
    secret_name: MY_MYSQL
    primary_key: id