You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/03/31 14:43:03 UTC

[GitHub] [airflow] romainjln opened a new issue #8031: BigQueryCursor not using Location when fetching results.

romainjln opened a new issue #8031: BigQueryCursor not using Location when fetching results.
URL: https://github.com/apache/airflow/issues/8031
 
 
   <!--
   
   Welcome to Apache Airflow!  For a smooth issue process, try to answer the following questions.
   Don't worry if they're not all applicable; just try to include what you can :-)
   
   If you need to include code snippets or logs, please put them in fenced code
   blocks.  If they're super-long, please use the details tag like
   <details><summary>super-long log</summary> lots of stuff </details>
   
   Please delete these comment blocks before submitting the issue.
   
   -->
   
   <!--
   
   IMPORTANT!!!
   
   Please complete the next sections or the issue will be closed.
   This questions are the first thing we need to know to understand the context.
   
   -->
   
   **Apache Airflow version**: 1.10.9
   
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`):
   
   **Environment**: Might not be relevant (UNIX)
   
   - **Cloud provider or hardware configuration**: GCP but able to reproduce that locally too
   - **OS** (e.g. from /etc/os-release):
   - **Kernel** (e.g. `uname -a`):
   - **Install tools**:
   - **Others**:
   
   **What happened**:
   We are trying to use Airflow BigQueryHook to get some records from our warehouse (via method get_records inherited from the class DbApiHook) in a custom sensor class. The dataset that has the table we are querying is located in `europe-west2`
   
   The BigQuery job is properly sent/received to/by our BigQuery server and according to the WebUI of BigQuery, the query is successful. 
   
   In the log of the Airflow task, we can see that the task switches from:
   (checking the status of the job)
   ```
   INFO - URL being requested: GET https://bigquery.googleapis.com/bigquery/v2/projects/{our_project}/jobs/{job_id}?location=europe-west2&alt=json
   ```
   to:
   (trying to get the results of the query)
   ```
   INFO - URL being requested: GET https://bigquery.googleapis.com/bigquery/v2/projects/{our_project}/queries/{job_id}?alt=json
   ```
   But this http request returns a 404 error: Job not found. 
   
   **What you expected to happen**:
   We expect the job to be found and the result of our query to be returned.
   
   **Possible explanation**
   By inspecting the logs, we can see that in the second GET http request the location parameter is not used. 
   We think that this could be explained by the fact that the function `next()` of the class `BigQueryCursor` calls the method `getQueryResults` without passing the parameter `location`. 
   
   **How to reproduce it**:
   By creating a table in a dataset located in `europe-west2` (I guess any region would exhibit this behaviour as long as the dataset is not located in a multi-region like EU or US) and running the following function in a PythonOperator for example:
   ```
   def check_bug(conn_id):
       hook = BigQueryHook(conn_id, use_legacy_sql=False) # same result when using parameter location='europe-west2'
       records = hook.get_records('''SELECT 1 FROM {newly_created_table}''')
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] mik-laj commented on issue #8031: BigQueryCursor not using Location when fetching results.

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #8031: BigQueryCursor not using Location when fetching results.
URL: https://github.com/apache/airflow/issues/8031#issuecomment-606692832
 
 
   In Q2, we're planning major upgrades for BigQuery operators. Your opinion is very important and we will definitely take it into account during our work.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] boring-cyborg[bot] commented on issue #8031: BigQueryCursor not using Location when fetching results.

Posted by GitBox <gi...@apache.org>.
boring-cyborg[bot] commented on issue #8031: BigQueryCursor not using Location when fetching results.
URL: https://github.com/apache/airflow/issues/8031#issuecomment-606671395
 
 
   Thanks for opening your first issue here! Be sure to follow the issue template!
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services