Skip to main content
Version: Next

GcsFile

Google Cloud Storage file source connector

Support Those Engines​

Spark
Flink
SeaTunnel Zeta

Key Features​

Description​

Reads files from Google Cloud Storage through the Google Cloud Storage connector for Hadoop. The connector reuses SeaTunnel's file source implementation for format parsing, schema discovery, projection, splitting, and multiple-table jobs.

Set bucket to a bucket URI such as gs://my-bucket. Set path to the object or prefix inside that bucket, such as /data/orders. Do not include an object path in bucket.

Dependency​

The connector uses com.google.cloud.bigdataoss:gcs-connector:hadoop3-2.2.33:shaded, which is Apache License 2.0 software and targets Java 8. The shaded GCS Hadoop library is packaged in the connector-file-gcs connector JAR. Spark and Flink deployments must provide a compatible Hadoop 3 runtime on every driver and worker.

Authentication​

The connector supports these authentication modes:

  1. Application Default Credentials (ADC): omit service_account_key_file. The Hadoop GCS connector discovers credentials from GOOGLE_APPLICATION_CREDENTIALS or the service account attached to the Google Cloud runtime.
  2. Service-account JSON file: set service_account_key_file to a local path that exists at the same location on every node that reads GCS.

The explicit service_account_key_file option takes precedence over the corresponding entry in hadoop_gcs_properties.

Options​

NameTypeRequiredDefaultDescription
pathstringyes-Object or prefix path inside bucket, for example /data/orders.
file_format_typestringyes-File format: text, csv, parquet, orc, json, excel, xml, binary, markdown, or pdf.
bucketstringyes-GCS bucket URI, for example gs://my-bucket.
service_account_key_filestringno-Service-account JSON key file on every worker. When omitted, ADC is used.
hadoop_gcs_propertiesmapno-Additional fs.gs.* Hadoop properties. Explicit connector options take precedence.
schemaconfigconditional-Required for text, json, excel, csv, and xml. See Schema Feature.
read_columnslistno-Columns to project from the source.
read_partitionslistno-The partitions that the user wants to read, e.g. ["year=2024"]. When set, only these partitions are read.
field_delimiterstringno\001 for text, , for CSVField delimiter for text and CSV files. delimiter is an alias.
row_delimiterstringno\nRow delimiter for text files.
skip_header_row_numberlongno0Number of initial text or CSV rows to skip.
encodingstringnoUTF-8Character encoding for text, JSON, CSV, and XML files.
parse_partition_from_pathbooleannotrueAdds partition values parsed from paths such as /year=2026/month=08.
recursive_file_scanbooleannotrueWhether to scan subdirectories recursively.
file_filter_patternstringno-File name filter pattern.
filename_extensionstringno-File extension filter, for example csv or .json.
compress_codecstringnononeCompression codec for a single compressed file.
archive_compress_codecstringnononeArchive compression codec.
enable_file_splitbooleannofalseEnables logical splitting for uncompressed text, CSV, JSON, and Parquet files.
file_split_sizelongconditional134217728Split size in bytes when enable_file_split=true.
null_formatstringno-Text representation of null values.
quote_charstringno"CSV quote character.
escape_charstringno-CSV escape character.
sheet_namestringno-Excel worksheet to read.
excel_enginestringnoPOIExcel reader: POI or EasyExcel.
poi_excel_max_file_sizelongno52428800Maximum Excel file size in bytes for the POI engine.
xml_row_tagstringconditional-XML element representing one row.
xml_use_attr_formatbooleanconditional-Whether XML values are read from attributes.
discovery_modestringnoonceonce or continuous. Continuous mode currently requires update sync and binary format.
scan_intervalstringno10SPoll interval for continuous discovery.
start_modestringnoearliestearliest processes existing files; latest starts with later changes.
sync_modestringnofullfull or update. Update mode currently supports binary format only.
target_pathstringconditional-Required for sync_mode=update; used to compare objects by relative path.
target_hadoop_confmapno-Hadoop configuration for the comparison target.
update_strategystringnodistcpUpdate comparison strategy: distcp or strict.
compare_modestringnolen_mtimelen_mtime or checksum; checksum requires strict strategy.
update_compare_parallelismintno8Parallelism for target metadata lookups, from 1 through 64.
update_compare_bulk_thresholdintno0Positive values enable bulk directory listing at the threshold; 0 disables it.
post_sync_actionstringnononePost-checkpoint action for continuous discovery: none, delete, or backup.
backup_pathstringconditional-Required for post_sync_action=backup. Must not overlap the source path.
retention_max_agestringno-Maximum age for SeaTunnel backup objects.
retention_check_intervalstringno1HBackup retention scan interval.
common-optionsno-See Source Common Options.

Example​

Read Parquet With ADC​

source {
GcsFile {
bucket = "gs://my-bucket"
path = "/warehouse/orders"
file_format_type = "parquet"
}
}

Read CSV With a Service Account​

source {
GcsFile {
bucket = "gs://my-bucket"
path = "/landing/customers"
file_format_type = "csv"
service_account_key_file = "/opt/seatunnel/keys/gcs-reader.json"
skip_header_row_number = 1
schema {
fields {
id = long
name = string
}
}
hadoop_gcs_properties = {
"fs.gs.project.id" = "my-project"
}
}
}

Changelog​

Change Log
ChangeCommitVersion