Skip to main content
Version: Next

SmbFile

SMB file sink connector

Description​

Output data to SMB (Server Message Block) file shares.

tip

If you use spark/flink, In order to use this connector, You must ensure your spark/flink cluster already integrated hadoop. The tested hadoop version is 2.x.

If you use SeaTunnel Engine, It automatically integrated the hadoop jar when you download and install SeaTunnel Engine. You can check the jar package under ${SEATUNNEL_HOME}/lib to confirm this.

Key features​

  • multimodal

    Use binary file format to read and write files in any format, such as videos, pictures, etc. In short, any files can be synchronized to the target place.

  • exactly-once

    By default, we use 2PC commit to ensure exactly-once

  • cdc

  • support multiple table write

  • timer flush

  • file format type

    • text
    • csv
    • parquet
    • orc
    • json
    • excel
    • xml
    • binary

Options​

nametyperequireddefault valueremarks
hoststringyes-The SMB server host
portintno445The SMB server port
userstringyes-The SMB authentication username
passwordstringno-The SMB authentication password
domainstringno(empty)The SMB authentication domain (e.g. WORKGROUP)
sharestringyes-The SMB share name to connect to
pathstringyes-The target file path within the share
tmp_pathstringno/tmp/seatunnelThe result file will write to a tmp path first and then use mv to submit tmp dir to target dir.
custom_filenamebooleannofalseWhether you need custom the filename
file_name_expressionstringno"${transactionId}"Only used when custom_filename is true
filename_time_formatstringno"yyyy.MM.dd"Only used when custom_filename is true
file_format_typestringno"csv"Supported file types: text, csv, parquet, orc, json, excel, xml, binary
filename_extensionstringno-Override the default file name extensions with custom file name extensions
field_delimiterstringno'\001' for text and ',' for csvOnly used when file_format_type is text and csv
row_delimiterstringno"\n"Only used when file_format_type is text, csv and json
have_partitionbooleannofalseWhether you need processing partitions.
partition_byarrayno-Only used when have_partition is true
partition_dir_expressionstringno"${k0}=${v0}/${k1}=${v1}/.../${kn}=${vn}/"Only used when have_partition is true
is_partition_field_write_in_filebooleannofalseOnly used when have_partition is true
sink_columnsarraynoWhen this parameter is empty, all fields are sink columns
is_enable_transactionbooleannotrue
batch_sizeintno1000000
compress_codecstringnonone
common-optionsobjectno-
max_rows_in_memoryintno-Only used when file_format_type is excel.
sheet_namestringnoSheet${Random number}Only used when file_format_type is excel.
xml_root_tagstringnoRECORDSOnly used when file_format is xml.
xml_row_tagstringnoRECORDOnly used when file_format is xml.
xml_use_attr_formatbooleanno-Only used when file_format is xml.
single_file_modebooleannofalseEach parallelism will only output one file.
encodingstringnoUTF-8Only used when file_format_type is text, json, csv, xml
date_formatstringnoyyyy-MM-ddDate type format
datetime_formatstringnoyyyy-MM-dd HH:mm:ssDatetime type format
time_formatstringnoHH:mm:ssTime type format
create_empty_file_when_no_databooleannofalseWhether to create an empty file when no data
schema_save_modestringnoCREATE_SCHEMA_WHEN_NOT_EXISTExisting dir processing method
data_save_modestringnoAPPEND_DATAExisting data processing method
enable_header_writebooleannofalseOnly used when file_format_type is text, csv. false: don't write header, true: write header.
parquet_avro_write_timestamp_as_int96booleannofalseOnly used when file_format is parquet.
parquet_avro_write_fixed_as_int96arrayno-Only used when file_format is parquet.

Example​

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

source {
FakeSource {
schema = {
fields {
name = string
age = int
}
}
}
}

sink {
SmbFile {
host = "192.168.1.100"
port = 445
user = seatunnel
password = pass
domain = "WORKGROUP"
share = "data"
path = "/output/csv"
tmp_path = "/tmp/seatunnel"
file_format_type = "csv"
}
}

Changelog​

next version​

New Features​

  • [Feature] Support SMB file connector (10753)