Skip to main content
Version: 2.3.13

Databend

Databend sink connector

Supported Engines​

Spark
Flink
SeaTunnel Zeta

Key Features​

Description​

A sink connector for writing data to Databend. Supports both batch and streaming processing modes. The Databend sink internally implements bulk data import through stage attachment.

Dependencies​

  1. You need to download the Databend JDBC driver jar package and add it to the directory ${SEATUNNEL_HOME}/plugins/.

For SeaTunnel Zeta​

  1. You need to download the Databend JDBC driver jar package and add it to the directory ${SEATUNNEL_HOME}/lib/.

Sink Options​

NameTypeRequiredDefault ValueDescription
urlStringYes-Databend JDBC connection URL
usernameStringYes-Databend database username
passwordStringYes-Databend database password
databaseStringNo-Databend database name, defaults to the database name specified in the connection URL
tableStringNo-Databend table name
batch_sizeIntegerNo1000Number of records for batch writing
auto_commitBooleanNotrueWhether to auto-commit transactions
max_retriesIntegerNo3Maximum retry attempts on write failure
schema_save_modeEnumNoCREATE_SCHEMA_WHEN_NOT_EXISTSchema save mode
data_save_modeEnumNoAPPEND_DATAData save mode
custom_sqlStringNo-Custom write SQL, typically used for complex write scenarios
execute_timeout_secIntegerNo300SQL execution timeout (seconds)
jdbc_configMapNo-Additional JDBC connection configuration, such as connection timeout parameters
conflict_keyStringNo-Conflict key for CDC mode, used to determine the primary key for conflict resolution
enable_deleteBooleanNofalseWhether to allow delete operations in CDC mode

schema_save_mode [Enum]​

Before starting the synchronization task, choose different processing schemes for existing table structures. Option descriptions:
RECREATE_SCHEMA: Create when table doesn't exist, drop and recreate when table exists.
CREATE_SCHEMA_WHEN_NOT_EXIST: Create when table doesn't exist, skip when table exists.
ERROR_WHEN_SCHEMA_NOT_EXIST: Report error when table doesn't exist.
IGNORE: Ignore table processing.

data_save_mode [Enum]​

Before starting the synchronization task, choose different processing schemes for existing data on the target side. Option descriptions:
DROP_DATA: Retain database structure and delete data.
APPEND_DATA: Retain database structure and data.
CUSTOM_PROCESSING: User-defined processing.
ERROR_WHEN_DATA_EXISTS: Report error when data exists.

Data Type Mapping​

SeaTunnel Data TypeDatabend Data Type
BOOLEANBOOLEAN
TINYINTTINYINT
SMALLINTSMALLINT
INTINT
BIGINTBIGINT
FLOATFLOAT
DOUBLEDOUBLE
DECIMALDECIMAL
STRINGSTRING
BYTESVARBINARY
DATEDATE
TIMETIME
TIMESTAMPTIMESTAMP

Task Examples​

Simple Example​

env {
execution.parallelism = 1
job.mode = "BATCH"
}

source {
FakeSource {
row.num = 10
schema = {
fields {
name = string
age = int
score = double
}
}
}
}

sink {
Databend {
url = "jdbc:databend://localhost:8000"
username = "root"
password = ""
database = "default"
table = "target_table"
batch_size = 1000
}
}

Writing with Custom SQL​

sink {
Databend {
url = "jdbc:databend://localhost:8000"
username = "root"
password = ""
database = "default"
table = "target_table"
custom_sql = "INSERT INTO default.target_table(name, age, score) VALUES(?, ?, ?)"
}
}

Using Schema Save Mode​

sink {
Databend {
url = "jdbc:databend://localhost:8000"
username = "root"
password = ""
database = "default"
table = "target_table"
schema_save_mode = "RECREATE_SCHEMA"
data_save_mode = "APPEND_DATA"
}
}

CDC mode​

sink {
Databend {
url = "jdbc:databend://databend:8000/default?ssl=false"
username = "root"
password = ""
database = "default"
table = "sink_table"

# Enable CDC mode
batch_size = 1
conflict_key = "id"
enable_delete = true
}
}

Changelog​

Change Log
ChangeCommitVersion
[Fix][Connector-V2][Databend] Ensure CDC final merge on committer close (#10349)https://github.com/apache/seatunnel/commit/48968fb4e92.3.13
[Feature][Connector-V2] Support CDC mode for databend sink connector (#9661)https://github.com/apache/seatunnel/commit/073ebeeddf2.3.13
[Feature][Connector-V2] Support databend source/sink connector (#9331)https://github.com/apache/seatunnel/commit/2f96f2e46c2.3.12