2017-09-12 6 views
1

unten das Beispiel ausprobieren:BigQuery mit Airflow - fehlende projectId

https://cloud.google.com/blog/big-data/2017/07/how-to-aggregate-data-for-bigquery-using-apache-airflow

Während einer der Befehle ausgeführt wird:

airflow test bigquery_github_trends_v1 bq_check_githubarchive_day 2017-06-02 

einen Fehler bekommen: Typeerror: Fehlende erforderliche Parameter „projectId

Fehlerstapel:

[2017-09-11 16:32:26,630] {models.py:1126} INFO - Dependencies all met for <TaskInstance: bigquery_github_trends_v1.bq_check_githubarchive_day 2017-06-02 00:00:00 [None]> 
[2017-09-11 16:32:26,631] {models.py:1126} INFO - Dependencies all met for <TaskInstance: bigquery_github_trends_v1.bq_check_githubarchive_day 2017-06-02 00:00:00 [None]> 
[2017-09-11 16:32:26,632] {models.py:1318} INFO - 
----------------------------------------------------------------------- 
--------- 
Starting attempt 1 of 6 
----------------------------------------------------------------------- 
--------- 

[2017-09-11 16:32:26,632] {models.py:1342} INFO - Executing <Task(BigQueryCheckOperator): bq_check_githubarchive_day> on 2017-06-02 00:00:00 
[2017-09-11 16:32:26,643] {check_operator.py:75} INFO - Executing SQL check: 
#legacySql 
SELECT table_id 
FROM [githubarchive:day.__TABLES__] 
WHERE table_id = "20170601" 

[2017-09-11 16:32:26,646] {gcp_api_base_hook.py:73} INFO - Getting connection using `gcloud auth` user, since no key file is defined for hook. 
[2017-09-11 16:32:26,671] {models.py:1417} ERROR - Missing required parameter "projectId" 
Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/site-packages/airflow/models.py", line 1374, in run 
result = task_copy.execute(context=context) 
    File "/usr/local/lib/python2.7/site-packages/airflow/operators/check_operator.py", line 76, in execute 
records = self.get_db_hook().get_first(self.sql) 
    File "/usr/local/lib/python2.7/site-packages/airflow/hooks/dbapi_hook.py", line 135, in get_first 
cur.execute(sql) 
    File "/usr/local/lib/python2.7/site-packages/airflow/contrib/hooks/bigquery_hook.py", line 752, in execute 
self.job_id = self.run_query(bql) 
    File "/usr/local/lib/python2.7/site-packages/airflow/contrib/hooks/bigquery_hook.py", line 244, in run_query 
return self.run_with_configuration(configuration) 
    File "/usr/local/lib/python2.7/site-packages/airflow/contrib/hooks/bigquery_hook.py", line 498, in run_with_configuration 
.insert(projectId=self.project_id, body=job_data) \ 
    File "/usr/local/lib/python2.7/site-packages/googleapiclient/discovery.py", line 716, in method 
raise TypeError('Missing required parameter "%s"' % name) 
TypeError: Missing required parameter "projectId" 

Antwort