-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
📝 (providers_google) add a location check #19571
Conversation
Could you please add a unit test for that ? |
if self.location is None: | ||
raise Exception("Need to specify location when instantiating BigQueryHook, otherwise it would result in Job Not Found error!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of failing on runtime, can we instead detect this in __init__
and fail the entire DAG when location
is invalid? Or is location=None
a valid value for certain use cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea location=None
works for other function and seems to me that it only fails when invoking get_records()
...
btw I might need to postpone this PR, will try to finish it by the end of Nov
will ping @uranusjr for help 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK this sounds like a good reason.
Could you change this to raise AirflowException
(or a subclass BigQueryLocationUnset
) instead? This pattern is more common in Airflow than raising a barebone Exception
.
I’d do
raise BigQueryLocationUnset("Parameter 'location' is required to fetch records with BigQuery hook")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will do. Thx for the inputs 🎉
sure~ |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
@david30907d are you still willing to work on this one? |
Hi @turbaszek , probably not 😅 btw, if you get a chance, would you check this problem please? 🙏 |
1f23dd1
to
f07ca3b
Compare
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease. |
@david30907d can you resolve conflicts and rebase? |
@david30907d can you resolve conflicts and rebase so we can merge this PR? |
oh so sorry I missed this thread, on it! |
f07ca3b
to
42e479b
Compare
if you didn't, you'll get this `returned "Not found: Job xxx"` exception
41d4225
to
e82c4fa
Compare
@eladkal sorry for the late reply, I finally figure out how to rebase 😅 (i'm git noob) |
As of last week you can EASILY do rebase with the GitHub UI: |
if you didn't, you'll get this
returned "Not found: Job xxx"
exceptioncloses: #19570
Although BigQueryHook says
location
is optional, turns out it's required under some scenariocode
when we invoke
get_records()
(here), it would end up go to thisrun_query()
to get thejob id
(here).another alternative is raise a
missing location exception
inrun_query()
thoughts on this?
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.