CockroachDB is a distributed SQL database system developed by Cockroach Labs that is designed for scalability and resilience. Since CockroachDB is compatible with PostgreSQL, you can sink data from RisingWave to CockroachDB using the JDBC sink connector.
You can test out this process on your own device by using the cockroach-sink
demo in the integration_test directory of the RisingWave repository.
Since CockroachDB is PostgreSQL-compatible, the syntax and parameters are the same as creating a PostgreSQL sink. For the syntax and parameters, see Create a sink.
Assume that we have a materialized view, mv1
, and we want to sink data from mv1
to a table in CockroachDB called target_count
. The following SQL query achieves this by creating a sink in RisingWave called sink1
.
RisingWave Data Type | CockroachDB Data Type |
---|---|
boolean | BOOL |
smallint | INT2 |
integer | INT4 |
bigint | INT |
numeric | DECIMAL |
real | REAL |
double precision | DOUBLE PRECISION |
varchar | STRING |
bytea | BYTES |
date | DATE |
time without time zone | TIME |
timestamp without time zone | TIMESTAMP |
timestamp with time zone | TIMESTAMPTZ |
interval | INTERVAL |
JSONB | JSONB |
array | ARRAY |
struct | Unsupported |
Only one-dimensional arrays in RisingWave can be sinked to CockroachDB.
For array type, we only support smallint
, integer
, bigint
, real
, double precision
, and varchar
type now.