CREATE SINK
Use the CREATE SINK
command to create a sink. A sink is an external target where you can send data processed in RisingWave. You can create a sink from a table or a materialized view.
If your goal is to create an append-only sink, you can use the emit-on-window-close policy when creating the materialized view that you want to sink data from. For details about the policy, see Emit on window close.
Syntax
CREATE SINK [ IF NOT EXISTS ] sink_name
[FROM sink_from | AS select_query]
WITH (
connector = 'connector_name',
connector_parameter = 'value',
[ snapshot = 'true' | 'false' ],...
)
[ FORMAT data_format ENCODE data_encode [ (
format_parameter = 'value'
) ] ];
Parameters
Parameter | Description |
---|---|
sink_name | The name of the sink. |
col_name | The name of the column. |
sink_from | Specify the direct data source for output. It can be a materialized view or 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 . |
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.
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
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
.