Ingest data from MySQL table
Describes how to ingest data from MySQL table to RisingWave using table-valued function.
RisingWave allows you to query MySQL tables directly with the mysql_query
table-valued function (TVF). It offers a simpler alternative to Change Data Capture (CDC) when working with MySQL data in RisingWave.
Unlike CDC, which continuously syncs data changes, this function lets you fetch data directly from MySQL when needed. Therefore, this approach is ideal for static or infrequently updated data, as itβs more resource-efficient than maintaining a constant CDC connection.
PUBLIC PREVIEW
This feature is currently in public preview, meaning it is nearing the final product but may not yet be fully stable. If you encounter any issues or have feedback, please reach out to us via our Slack channel. Your input is valuable in helping us improve this feature. For more details, see our Public Preview Feature List.
Added in version 2.2.
Syntax
Define mysql_query
as follows:
Data type mapping
The following table shows how MySQL data types are mapped to RisingWave data types:
MySQL Type | RisingWave Type |
---|---|
bit(1) | boolean |
bit(>1) | bytea |
bool /boolean | smallint |
tinyint | smallint |
smallint | smallint |
mediumint | int |
int | int |
bigint | bigint |
float | float32 |
double | float64 |
decimal | decimal |
numeric | decimal |
year | int |
date | date |
time | time |
datetime | timestamp |
timestamp | timestamptz |
varchar | varchar |
char | varchar |
json | jsonb |
blob | bytea |
tinyblob | bytea |
mediumblob | bytea |
longblob | bytea |
array | unsupported |
enum | unsupported |
set | unsupported |
geometry | unsupported |
null | unsupported |
Example
- In your MySQL database, create a table and populate it with sample data of various data types.
- In RisingWave, use
postgres_query
function to perform the query.
Was this page helpful?