根据官方文档和代码实现,bigqueryoperator的write_truncate操作是在1个事务中执行的。具体实现可以查看airflow.providers.google.cloud.operators.bigquery模块中的代码。
示例代码:
from airflow.providers.google.cloud.operators.bigquery import BigQueryDeleteTableOperator
delete_table_operator = BigQueryDeleteTableOperator( task_id="delete_table_operator", deletion_dataset_table="my_dataset.my_table", write_disposition="WRITE_TRUNCATE", use_legacy_sql=False, dag=dag, )
delete_table_operator.execute(context={})