【发布时间】:2020-07-06 01:54:59
【问题描述】:
我的 Aitflow 流程具有以下结构:
dags/mainDag.py
dags/BigQuery/deleteData.py
dags/BigQuery/insertData.py
dags/support/gcp.json
dags/support/__init__py
我的mainDag.py 正在调用deleteData.py 和insertData.py,这有效!但我的问题是:在这两个文件中,我都使用 gcp.json 这样的:
credentialsPath = "~/airflow/dags/support/gqp.json"
bigqueryClient = bigquery.Client.from_service_account_json(credentialsPath)
在 Airflow Webserver 中我遇到了这个错误:
FileNotFoundError: [Errno 2] 没有这样的文件或目录:'~/airflow/dags/support/gqp.json'
但我可以成功地使用此路径在我的 bash 上捕获文件内容。 我在堆栈中阅读了这两个问题,[airflow: how can i put the method for read a json file in a local library 和 [Airflow - Python file NOT in the same DAG folder,但都不起作用! 有谁知道如何解决这个问题?
【问题讨论】: