Syntax
Parameters
| Parameter | Description |
|---|---|
| sink_name | The name of the sink. |
| col_name | The name of the column. |
| sink_from | Specify the upstream for the sink: a source, table, or materialized view. For CDC data, the upstream must be a table. |
| select_query | Specify the data to be output to the sink. |
| snapshot | Optional. Currently, to modify the definition or query of an existing sink, you need to drop and re-create the sink, but this approach generates excessive duplicates due to the mandatory backfilling. To avoid this, you can set the parameter to false to skip the backfilling phase and transmit only incremental changes. This option is only applicable when using the CREATE SINK FROM syntax, not CREATE SINK AS syntax. The default value is true. |
| force_compaction | Optional. When set to true, forces buffering and compaction even when the stream key matches the sink primary key exactly. This reduces the number of output messages by emitting at most one update per key within each barrier interval. The default value is false. For more information, see Force compaction. |
| WITH clause | Specify the connector settings here if trying to store all the sink data. See Supported sinks for the full list of supported sink as well as links to specific connector pages detailing the syntax for each sink. |
| FORMAT and ENCODE options | Optional. Specify the data format and the encoding format of the sink data. It is only used for Kafka, Kinesis, Pulsar, and Redis sinks. |
Please distinguish between the parameters set in the FORMAT and ENCODE options and those set in the WITH clause. Ensure that you place them correctly and avoid any misuse.
Backfill and isolation
When creating a sink, RisingWave will backfill historical data from the upstream source, table, or materialized view (unlesssnapshot=false is specified). To improve isolation between the backfill phase and streaming phase, you can enable snapshot backfill by setting SET streaming_use_snapshot_backfill=true; before creating the sink. This helps prevent resource contention between backfilling historical data and processing new streaming data. For more details, see View and configure runtime parameters.
Supported sinks
Click a sink name to see the SQL syntax, options, and sample statement of sinking data from RisingWave to the sink.- Apache Doris
- Apache Iceberg
- AWS Kinesis
- Cassandra or ScyllaDB
- ClickHouse
- CockroachDB
- Delta Lake
- Elasticsearch
- Google BigQuery
- Kafka (Supports versions 3.1.0 or later)
- MySQL (Supports versions 5.7 and 8.0.x)
- NATS
- PostgreSQL
- Pulsar
- Redis
- StarRocks
- TiDB
See also
Overview of data delivery
DROP SINK
Remove a sink
SHOW CREATE SINK
Show the SQL statement used to create a sink
CREATE SINK INTO
Create a sink into RisingWave’s table
Timestamptz values are stored in UTC.When sinking downstream, the representation of timestamptz is configurable. By default, it is in the format
2023-11-11T18:30:09.453000Z.