BigQuery with Airflow - missing projectId -


trying out example below:

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

while running 1 of commands:

airflow test bigquery_github_trends_v1 bq_check_githubarchive_day 2017-06-02 

getting error : typeerror: missing required parameter "projectid"

error stack:

[2017-09-11 16:32:26,630] {models.py:1126} info - dependencies met <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 met <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  [githubarchive:day.__tables__]  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 defined 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" 

if check code bigquery_hook, find checking project_id, https://github.com/apache/incubator-airflow/blob/master/airflow/contrib/hooks/bigquery_hook.py#l54

the default connection bigquery_default unless override it, go airflow ui, go admin --> connection --> bigquery_default (or whatever created) --> add project id there

enter image description here


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -