Skip to main content

Sink data from RisingWave to SQL Server

This guide describes how to sink data from RisingWave to Microsoft SQL Server.

You can test out this process on your own device by using the sqlserver_sink.slt demo in the integration_test directory of the RisingWave repository.

Prerequisites

Before sinking data from RisingWave to SQL Server, please ensure the following:

  • The SQL Server table you want to sink to is accessible from RisingWave.
  • You have an upstream materialized view or table in RisingWave that you can sink data from.

Syntax

CREATE SINK [ IF NOT EXISTS ] sink_name
[FROM sink_from | AS select_query]
WITH (
connector='sqlserver',
connector_parameter = 'value', ...
);

Parameters

Parameter NamesDescription
typeRequired. Allowed values: append-only and upsert.
force_append_onlyOptional. If true, forces the sink to be append-only, even if it cannot be.
primary_keyConditional. The primary keys of the sink. Use ',' to delimit the primary key columns. Primary keys are required for upsert sinks.
sqlserver.hostRequired. The SQL Server host.
sqlserver.portRequired. The SQL Server port.
sqlserver.userRequired. The user for SQL Server access.
sqlserver.passwordRequired. The password for SQL Server access.
sqlserver.databaseRequired. The SQL Server database you want to sink to.
sqlserver.tableRequired. The SQL Server table you want to sink to.

Data type mapping

The following table shows the corresponding data types between RisingWave and SQL Server that should be specified when creating a sink. For details on native RisingWave data types, see Overview of data types.

SQL Server typeRisingWave type
bitboolean
smallintsmallint
intinteger
bigintbigint
float(24)real
float(53)double
decimaldecimal
datedate
nvarcharvarchar
timetime
datetime2time without time zone
biginttimestamp without time zone
No supportinterval
No supportstruct
No supportarray
varbinarybytea
No supportjsonb
No supportserial

Help us make this doc better!