ClickHouseDest
class ClickHouseDest(
conn: ClickHouseConn,
destination_tables: str | list[str],
if_table_exists: IfTableExistStrategySpec = 'append',
)
Bases: DestinationPlugin
Categories: destination
Destination plugin for writing data to ClickHouse using cloud-staged bulk loading.
Data is first written as Parquet files to the configured cloud storage staging area
(S3, Azure Blob, or GCS) and then ingested into ClickHouse via its native table
functions (s3(), azureBlobStorage()).
Initialize a ClickHouseDest instance for writing data to ClickHouse.
Parameters
connThe ClickHouse connection configuration, including both the server parameters and the cloud staging configuration.
destination_tablesThe table(s) to load data into. A single table name may be provided as a string; multiple tables must be a list of strings.
if_table_existsThe strategy to follow when the table already exists. Defaults to 'append'. * 'append' — insert new rows into the existing table. * 'replace' — truncate the table before loading new rows.
Properties
connClickHouseConnThe ClickHouse connection configuration.
destination_tableslist[str]The table(s) to load data into.
if_table_existsIfTableExistStrategySpecThe strategy to follow when the table already exists.
Methods
streamdef stream(working_dir: str, *results: list[LazyFrame | None])
Write each result as a Parquet file and bulk load it into ClickHouse via the cloud staging area.
Parameters:
working_dirTemporary directory for intermediate Parquet files.
resultsOne polars LazyFrame (or None) per destination table, in the same order as destination_tables.