MySQL table function

BETA

The Tinybird mysql() table function is currently in private beta. If you're interested in early access, reach out to support.

The Tinybird mysql() table function allows you to read data from your existing MySQL database into Tinybird, then schedule a regular Copy Pipe to orchestrate synchronization. You can load full tables, and every run performs a full replace on the Data Source.

To use it, define a node using standard SQL and the mysql function keyword, then publish the node as a Copy Pipe that does a sync on every run. See Table functions for general information and tips.

Syntax

Create a new Pipe Node. Call the mysql table function and pass the hostname and port, database, table, user, and password:

Example query logic
SELECT *
FROM mysql(
  'aws-0-eu-central-1.TODO.com:3866',
  'mysql',
  'orders',
  {{tb_secret('my_username')}},
  {{tb_secret('my_password')}},
)

Publish this node as a Copy Pipe. You can choose to append only new data or replace all data.

Type support and inference

Here's a detailed conversion table:

MySQL data typeTinybird data type
UNSIGNED TINYINTUInt8
TINYINTInt8
UNSIGNED SMALLINTUInt16
SMALLINTInt16
UNSIGNED INT, UNSIGNED MEDIUMINTUInt32
INT, MEDIUMINTInt32
UNSIGNED BIGINTUInt64
BIGINTInt64
FLOATFloat32
DOUBLEFloat64
DATEDate
DATETIME, TIMESTAMPDateTime
BINARYFixedString

Considerations

The following considerations apply to the mysql() table function:

  • Tinybird doesn't support all MySQL types directly, so some types are mapped to String, which is the most flexible type for arbitrary data.
  • Time zone support in Tinybird's DateTime can be managed via additional functions or by ensuring consistent storage and retrieval time zones.

See also

Updated