From 72b73271628e4a9cc5f42de89389bcf8bb2ce6d8 Mon Sep 17 00:00:00 2001 From: Eric Fu Date: Wed, 18 Dec 2024 16:00:23 +0800 Subject: [PATCH] jdbc sink: add user/password option --- integrations/destinations/cockroachdb.mdx | 4 +++- integrations/destinations/mysql.mdx | 14 ++++++++------ integrations/destinations/postgresql.mdx | 14 ++++++++------ integrations/destinations/supabase.mdx | 4 +++- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/integrations/destinations/cockroachdb.mdx b/integrations/destinations/cockroachdb.mdx index bbc27f7d..71a7fa8b 100644 --- a/integrations/destinations/cockroachdb.mdx +++ b/integrations/destinations/cockroachdb.mdx @@ -24,7 +24,9 @@ CREATE SINK sink1 FROM mv1 WITH ( connector = 'jdbc', - jdbc.url = 'jdbc:postgresql://cockroachdb:26257/defaultdb?user=root', + jdbc.url = 'jdbc:postgresql://cockroachdb:26257/defaultdb', + user = 'root', + password = '...', table.name = 'target_count', type = 'upsert', primary_key = 'target_id' diff --git a/integrations/destinations/mysql.mdx b/integrations/destinations/mysql.mdx index d8cd4938..2e0ccf9b 100644 --- a/integrations/destinations/mysql.mdx +++ b/integrations/destinations/mysql.mdx @@ -115,17 +115,17 @@ WITH ( ### Parameters -All `WITH` options are required. - -| Parameter or clause | Description | +| Parameter or clause | Description | | :------------------ | :------------- | | sink\_name | Name of the sink to be created. | | sink\_from | A clause that specifies the direct source from which data will be output. `sink_from` can be a materialized view or a table. Either this clause or a SELECT query must be specified. | | AS select\_query | A SELECT query that specifies the data to be output to the sink. Either this query or a FROM clause must be specified. See [SELECT](/sql/commands/sql-select) for the syntax and examples of the SELECT command. | | connector | Sink connector type must be `jdbc` for MySQL sink. | -| jdbc.url | The JDBC URL of the destination database necessary for the driver to recognize and connect to the database. | +| jdbc.url | Required. The JDBC URL of the destination database necessary for the driver to recognize and connect to the database. | +| user | The user name for the database connection. | +| password | The password for the database connection. | | jdbc.query.timeout | Specifies the timeout for the operations to downstream. If not set, the default is 10 minutes. | -| table.name | The table in the destination database you want to sink to. | +| table.name | Required. The table in the destination database you want to sink to. | | type | Data format. Allowed formats: | | primary\_key | Required if type is upsert. The primary key of the downstream table. | @@ -145,7 +145,9 @@ CREATE TABLE personnel ( CREATE SINK s_mysql FROM personnel WITH ( connector='jdbc', - jdbc.url='jdbc:mysql://:/test_db?user=&password=', + jdbc.url='jdbc:mysql://:/test_db', + user='', + password='', table.name='personnel', type = 'upsert', primary_key = 'id' diff --git a/integrations/destinations/postgresql.mdx b/integrations/destinations/postgresql.mdx index 3321b998..7ad6d225 100644 --- a/integrations/destinations/postgresql.mdx +++ b/integrations/destinations/postgresql.mdx @@ -90,18 +90,18 @@ WITH ( ### Parameters -All `WITH` options are required unless noted. - | Parameter or clause | Description | | :------------------ | :-------------- | | sink\_name | Name of the sink to be created. | | sink\_from | A clause that specifies the direct source from which data will be output. `sink_from` can be a materialized view or a table. Either this clause or a SELECT query must be specified. | | AS select\_query | A SELECT query that specifies the data to be output to the sink. Either this query or a FROM clause must be specified. See [SELECT](/sql/commands/sql-select) for the syntax and examples of the SELECT command. | | connector | Sink connector type must be `jdbc` for PostgresQL sink. | -| jdbc.url | The JDBC URL of the destination database necessary for the driver to recognize and connect to the database. | +| jdbc.url | Required. The JDBC URL of the destination database necessary for the driver to recognize and connect to the database. | +| user | The user name for the database connection. | +| password | The password for the database connection. | | jdbc.query.timeout | Specifies the timeout for the operations to downstream. If not set, the default is 10 minutes. | -| table.name | The table in the destination database you want to sink to. | -| schema.name | Optional. The schema in the destination database you want to sink to. The default value is public. | +| table.name | Required. The table in the destination database you want to sink to. | +| schema.name | The schema in the destination database you want to sink to. The default value is public. | | type | Sink data type. Supported types:
  • `append-only`: Sink data as INSERT operations.
  • `upsert`: Sink data as UPDATE, INSERT and DELETE operations.
| | primary\_key | Required if type is upsert. The primary key of the sink, which should match the primary key of the downstream table. | @@ -151,7 +151,9 @@ Use the following query to sink data from the materialized view to the target ta ```sql CREATE SINK target_count_postgres_sink FROM target_count WITH ( connector = 'jdbc', - jdbc.url = 'jdbc:postgresql://postgres:5432/mydb?user=myuser&password=123456', + jdbc.url = 'jdbc:postgresql://postgres:5432/mydb', + user = 'myuser', + password = '123456', table.name = 'target_count', type = 'upsert', primary_key = 'target_id' diff --git a/integrations/destinations/supabase.mdx b/integrations/destinations/supabase.mdx index ba5b807e..eaf4e57c 100644 --- a/integrations/destinations/supabase.mdx +++ b/integrations/destinations/supabase.mdx @@ -19,7 +19,9 @@ The following SQL command creates a sink, `promotion_update`, that sinks data fr ```sql CREATE SINK promotion_update FROM product_calc_mv WITH ( connector='jdbc', - jdbc.url='jdbc:postgresql://xxxx.supabase.co:5432/postgres?user=postgres&password=xxx', + jdbc.url='jdbc:postgresql://xxxx.supabase.co:5432/postgres', + user = 'postgres', + password = 'xxx', table.name = 'promotions', type = 'upsert' );