GCSToBigQueryOperator 在 python 运算符中不起作用

问题描述 投票:0回答:1

当我使用 GCSToBigQueryOperator 时它可以工作,但是放入函数并从 python 运算符调用会出现以下错误;

文件“/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/google/cloud/transfers/gcs_to_bigquery.py”,第336行,执行中 逻辑日期=上下文[“逻辑日期”], 关键错误:“逻辑日期”

这是我的代码;

def fn_gcs_to_bqstg():
      task1 = GCSToBigQueryOperator(
           task_id='gcstobqstg',
           bucket=GCS_BUCKET,
           source_objects=['data/*.json'],
           destination_project_dataset_table='local_development.table',
           schema_object='schemas/data_schema.json',
           source_format='NEWLINE_DELIMITED_JSON',
           create_disposition='CREATE_IF_NEEDED',
           write_disposition='WRITE_TRUNCATE',
           gcp_conn_id='bq-conn',
           dag=dag
      )
      task1.execute(dict())

gcs_to_bqstg = PythonOperator(
      task_id='gcs_to_bqstg',
      python_callable=fn_gcs_to_bqstg) 

在函数内使用 GCSToBigQueryOperator 有什么问题或解决方案吗?

airflow etl
1个回答
0
投票

这个问题有什么解决办法吗?升级到2.5后我遇到了同样的问题

© www.soinside.com 2019 - 2024. All rights reserved.