StarRocksDest
class StarRocksDest(
tables: StarRocksTableNamesSpec,
if_table_exists: IfTableExistsSpec = 'append',
schema_evolution: SchemaEvolutionSpec = 'strict',
dest_cfg: DestCfgSpec | None = None,
)
Bases: Dest
Categories: destination
StarRocks destination for @subscriber -- one output slot per table.
The target tables must already exist; this destination does not
create them (StarRocks table creation needs physical layout -- a key
definition and a DISTRIBUTED BY clause -- that cannot be inferred
from the data). Writing to a missing table fails with a StarRocks
table-not-found error.
Examples
Append to an existing table -- row count grows each run:
@subscriber(
destination=StarRocksDest(
tables=["wld_country"], if_table_exists="append"
),
input_tables=["subs_tables/wld_country"],
)
def out_append(country: TableFrameSpec) -> TableFrameSpec:
return country
Replace truncates the target table, then reloads it:
@subscriber(
destination=StarRocksDest(
tables=["wld_city"], if_table_exists="replace"
),
input_tables=["subs_tables/wld_city"],
)
def out_replace(city: TableFrameSpec) -> TableFrameSpec:
return city
Parameters
tablesStarRocksTableNamesSpec (list[str])Target table names, one write slot per entry; each must
reference an existing table. Each is a 1- or 2-part name
(table or database.table); backtick-quote a part for
special characters.
if_table_existsIfTableExistsSpec (Literal['append', 'replace'])"append" (the default) issues
INSERT INTO; "replace" issues TRUNCATE +
INSERT INTO against the existing table.
schema_evolutionSchemaEvolutionSpec (Literal['strict', 'update'])What a write does when the batch's columns differ from
the table's. "strict" (the default) refuses a batch with a column
the table lacks or a wider type, except that a text column takes
any text (StarRocks refuses a value too long for it) and a narrower
number column takes a batch whose values all fit it; "update"
adds the column and widens the type, and refuses a change StarRocks
cannot make. A column the batch lacks is written NULL either way.
dest_cfgDestCfgSpec | None (Mapping[Literal['starrocks.logging_level', 'starrocks.schema_evolution_engine'], Any] | None)Optional connector config. Supported keys:
starrocks.logging_level, and
starrocks.schema_evolution_engine -- "iceberg", the default
and only engine: StarRocks has no schema evolution of its own. A
column type change runs as a StarRocks job, which the write waits
for before loading.