I have a cloud functions that loads a dataframe to bigquery and want to allow field addtions

My job_config is as follow but I always get an error saying that the ALLOW FIELD ADDTION is only available with table partittions. The destination table is already partition by date so I dont really know how to get this work.

job_config = bigquery.LoadJobConfig(
      schema=[bigquery.SchemaField("fecha", bigquery.enums.SqlTypeNames.DATE)],
      write_disposition="WRITE_TRUNCATE"
      ,create_disposition = "CREATE_IF_NEEDED"
      ,time_partitioning = bigquery.table.TimePartitioning(field="fecha")
      ,schema_update_options = 'ALLOW_FIELD_ADDITION'
    )
1

There are 1 answers

0
Aleksei Díaz On

Thre is no need to pass ,schema_update_options = 'ALLOW_FIELD_ADDITION' since the write_disposition="WRITE_TRUNCATE" will handle the schema changes.

Thank you all!