Skip to main content
Version: Next

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

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"
}
}

Changelog

Change Log
ChangeCommitVersion
[Feature][Connector-V2]Support Databend sink/source (#9331)https://github.com/apache/seatunnel/pull/9331TODO