BigQueryDest
class BigQueryDest(
tables: BigQueryTableNamesSpec,
if_table_exists: IfTableExistsSpec = 'append',
schema_evolution: SchemaEvolutionSpec = 'update',
dest_cfg: DestCfgSpec | None = None,
)
Bases: Dest
Categories: destination
BigQuery destination for @subscriber -- one output slot per table.
Examples
Overwrite the target table each run with if_table_exists="replace":
@subscriber(
destination=BigQueryDest(
tables=["`cap_replace`"],
if_table_exists="replace",
),
input_tables=["caps_input/cap_rows"],
)
def publish(rows: TableFrameSpec) -> TableFrameSpec:
return rows
Append a wider frame; schema_evolution="update" adds the new column:
@subscriber(
destination=BigQueryDest(
tables=["`cap_evolve`"],
if_table_exists="append",
schema_evolution="update",
),
input_tables=["caps_input/cap_evo_v2"],
)
def evolve(v2: TableFrameSpec) -> TableFrameSpec:
return v2
Parameters
parameter
tablesBigQueryTableNamesSpec (list[str])Target table names, one write slot per entry. Each is
[[project.]dataset.]table; a bare table or
dataset.table is completed from the connection's
project / dataset defaults. BigQuery wraps the whole
name in one backtick pair, e.g. my-project.ds.t.
parameter
if_table_existsIfTableExistsSpec (Literal['append', 'replace'])"append" (the default) adds rows;
"replace" drops and recreates the table.
parameter
schema_evolutionSchemaEvolutionSpec (Literal['update', 'strict'])"update" (the default) allows new columns;
"strict" rejects schema changes.
parameter
dest_cfgDestCfgSpec | None (Mapping[Literal['bigquery.logging_level'], Any] | None)Optional connector config; the only supported key is
bigquery.logging_level.