You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "e-galan (via GitHub)" <gi...@apache.org> on 2024/05/16 08:52:49 UTC

[PR] Fix BigQueryCursor execute method if the location is missing [airflow]

e-galan opened a new pull request, #39659:
URL: https://github.com/apache/airflow/pull/39659

   <!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
   
      http://www.apache.org/licenses/LICENSE-2.0
   
    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
    -->
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   This addresses a bug where `BigQueryValueCheckOperator` tasks failed if it was not provided with the location parameter and the dataset location was outside of the US.
   
   If the location parameter is not provided to `BigQueryValueCheckOperator`, then the location parameter will still be _None_ when execution reaches the `BigQueryCursor` execute method. The execute method makes two client requests: the first to the BigQuery client, which can work without the location provided, the second to the Google Discovery client, which cannot find a resource without the location resulting in a error. 
   
   Pulling the location from a successful BigQuery request result resolves that problem.
   
   Change list: 
   - Make BigQueryCursor use the job location in the case when the location is not provided during the cursor's instantiation.
   - Update typing and docstrings.
   
   <!-- Please keep an empty line above the dashes. -->
   ---
   **^ Add meaningful description above**
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix BigQueryCursor execute method if the location is missing [airflow]

Posted by "VladaZakharova (via GitHub)" <gi...@apache.org>.
VladaZakharova commented on PR #39659:
URL: https://github.com/apache/airflow/pull/39659#issuecomment-2126675527

   Hi @eladkal @potiuk !
   I guess we have made all the changes, can you please take a look again? :)


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix BigQueryCursor execute method if the location is missing [airflow]

Posted by "e-galan (via GitHub)" <gi...@apache.org>.
e-galan commented on PR #39659:
URL: https://github.com/apache/airflow/pull/39659#issuecomment-2123112267

   I have added the system test @dirrao @eladkal . Please take a look.


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix BigQueryCursor execute method if the location is missing [airflow]

Posted by "VladaZakharova (via GitHub)" <gi...@apache.org>.
VladaZakharova commented on PR #39659:
URL: https://github.com/apache/airflow/pull/39659#issuecomment-2120148328

   @eladkal 
   Yes, thank you , will be good to add system test here to cover this scenario: f.e. try to create dataset and table with location different from  `US` and then run BigQueryValueCheckOperator without specifying location.
   
   @e-galan Please, add the changes accordingly 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix BigQueryCursor execute method if the location is missing [airflow]

Posted by "e-galan (via GitHub)" <gi...@apache.org>.
e-galan commented on PR #39659:
URL: https://github.com/apache/airflow/pull/39659#issuecomment-2114866644

   > is it feasible to add the test case for the bug? Can you fix the failing static checks?
   
   @dirrao I can add a unit test, but it will be totally dependent on mocks, because the problem happens between the two client requests. Will that do?
   
   I can't fix the static check, it fails because of smth that does not seem related to my PR:
   ![image](https://github.com/apache/airflow/assets/53026723/898d3706-af16-42b0-b431-c3d96f25014f)
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix BigQueryCursor execute method if the location is missing [airflow]

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on PR #39659:
URL: https://github.com/apache/airflow/pull/39659#issuecomment-2114883194

   This static check failure not relevant your PR, it will be fix (at least temporary) by https://github.com/apache/airflow/pull/39662


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix BigQueryCursor execute method if the location is missing [airflow]

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on PR #39659:
URL: https://github.com/apache/airflow/pull/39659#issuecomment-2118717267

   > @dirrao I can add a unit test, but it will be totally dependent on mocks, because the problem happens between the two client requests. Will that do?
   
   We have system tests for google so probably we should modify/add coverage there. @VladaZakharova WDYT?


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fix BigQueryCursor execute method if the location is missing [airflow]

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal merged PR #39659:
URL: https://github.com/apache/airflow/pull/39659


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org