MySQL sink connector

Use the MySQL sink connector to get data from your Decodable streams to your MySQL Database.

Features

Delivery guarantee

Exactly once

Read from multiple streams

Yes

Prerequisites

  • The MySQL database must be accessible from the Decodable network.

  • You must have a MySQL user with the following privilege:

    • CREATE

    • DELETE

    • INSERT

    • SELECT

    • UPDATE

Steps

If you want to use the Decodable CLI or API to create the connection, you can refer to the Property Name column for information about what the underlying property names are. The connector name is mysql.
  1. From the Connections page, select MySQL and complete the following fields.

    UI Field

    Property Name

    Description

    Host

    hostname

    The host name for your MySQL database.

    Port

    port

    Optional. The port number to use when connecting to the host.

    Defaults to 3306.

    Database

    database-name

    The name of the database to connect to.

    Username

    username

    The username to use to authenticate to the server.

    Password

    password

    The password associated with the username. This must be provided as a secret.

  2. Select Next. The next screen shows the list of Decodable streams in your account.

  3. Select the streams that you want to send to MySQL. Decodable automatically creates a table in your database for each stream selected.

    By default, Decodable uses the stream name as the name of the table it creates. If a table already exists with that name and the schema of the stream matches the schema of the table, Decodable will write to the existing table.

    The schema of each stream is automatically translated to MySQL, including:

    • field names

    • data types (See Data types mapping for how Decodable types map to MySQL types)

    • primary keys

  4. (Optional) If you want to rename the tables to be created, you can override the generated table names.

  5. Select Next.

  6. Give the newly created connection a Name and Description. Then, select Save.

Connector starting state and offsets

A new sink connection will start reading from the Latest point in the source Decodable stream. This means that only data that’s written to the stream when the connection has started will be sent to the external system. You can override this when you start the connection to Earliest if you want to send all the existing data on the source stream to the target system, along with all new data that arrives on the stream.

When you restart a sink connection it will continue to read data from the point it most recently stored in the checkpoint before the connection stopped. You can also opt to discard the connection’s state and restart it afresh from Earliest or Latest as described above.

Learn more about starting state here.

Data types mapping

The table below shows the mapping from Decodable data types to MySQL data types.

Decodable Type MySQL Type

CHAR(n)

CHAR(n)

VARCHAR(n)

VARCHAR(n)

STRING

TEXT

BOOLEAN

BOOLEAN

DECIMAL(p, s)

DECIMAL(p, s)

TINYINT

TINYINT

SMALLINT

SMALLINT

INT/INTEGER

INT

BIGINT

BIGINT

FLOAT

FLOAT

DOUBLE [PRECISION]

DOUBLE

DATE

DATE

TIME(p)

TIME(p)

TIMESTAMP(p) [WITHOUT TIME ZONE]

DATETIME

TIMESTAMP(p) WITH LOCAL TIME ZONE

DATETIME

Resource specifier keys

When using the connection scan command of the Decodable CLI to create a connection specification, the following resource specifier keys are available:

Name Description

table-name

The table name