Databend Writer is a plugin for DataX to write data to Databend Table from dataX records. The plugin is based on databend JDBC driver which use RESTful http protocol to execute query on open source databend and databend cloud.
During each write batch, databend writer will upload batch data into internal S3 stage and execute corresponding insert SQL to upload data into databend table.
For best user experience, if you are using databend community distribution, you should try to adopt S3/minio/OSS as its underlying storage layer since they support presign upload operation otherwise you may expend unneeded cost on data transfer.
You could see more details on the doc
Databend Writer would use DataX to fetch records generated by DataX Reader, and then batch insert records to the designated columns for your databend table.
--- create table in databend
drop table if exists datax.sample1;
drop database if exists datax;
create database if not exists datax;
create table if not exsits datax.sample1(a string, b int64, c date, d timestamp, e bool, f string, g variant);
{
"job": {
"content": [
{
"reader": {
"name": "streamreader",
"parameter": {
"column" : [
{
"value": "DataX",
"type": "string"
},
{
"value": 19880808,
"type": "long"
},
{
"value": "1926-08-08 08:08:08",
"type": "date"
},
{
"value": "1988-08-08 08:08:08",
"type": "date"
},
{
"value": true,
"type": "bool"
},
{
"value": "test",
"type": "bytes"
},
{
"value": "{\"type\": \"variant\", \"value\": \"test\"}",
"type": "string"
}
],
"sliceRecordCount": 10000
}
},
"writer": {
"name": "databendwriter",
"parameter": {
"username": "databend",
"password": "databend",
"column": ["a", "b", "c", "d", "e", "f", "g"],
"batchSize": 1000,
"preSql": [
],
"postSql": [
],
"connection": [
{
"jdbcUrl": "jdbc:databend://localhost:8000/datax",
"table": [
"sample1"
]
}
]
}
}
}
],
"setting": {
"speed": {
"channel": 1
}
}
}
}
["*"]
instead.insert
and replace
two mode.Data types in datax can be converted to the corresponding data types in databend. The following table shows the correspondence between the two types.
DataX Type | Databend Type |
---|---|
INT | TINYINT, INT8, SMALLINT, INT16, INT, INT32, BIGINT, INT64 |
LONG | TINYINT, INT8, SMALLINT, INT16, INT, INT32, BIGINT, INT64 |
STRING | STRING, VARCHAR |
DOUBLE | FLOAT, DOUBLE |
BOOL | BOOLEAN, BOOL |
DATE | DATE, TIMESTAMP |
BYTES | STRING, VARCHAR |
Currently, complex data type support is not stable, if you want to use complex data type such as tuple, array, please check further release version of databend and jdbc driver.