-
Notifications
You must be signed in to change notification settings - Fork 14.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
Add impersonation_scopes
to BigQuery
#38169
Conversation
impersonation_scopes
to BigQuery
Can you add unit test to cover the change? |
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.
Checks are failing. Can you fix them? Can you add the unit test for the change suggested by @eladkal ?
i'll do another pass at it sometime this week |
I need some help figuring out how to write a test. I see that there is a cloud/operators/test_bigquery.py file with a The other example I looked at airflow/tests/providers/google/cloud/operators/test_cloud_storage_transfer_service.py Line 265 in 952d04a
but I'm not quite sure what that line is doing |
You could mock the impersonation chain as done in other tests of GCP hooks ( |
i think i fixed the test |
closes: #33400
Currently
scopes
for google libraries are taken from connection parameters, this PR creates an additional parameterimpersonation_scopes
that will be used in situations whenimpersonation_chain
is being used.The flow to get credentials for gcp providers goes something like this
airflow/airflow/providers/google/cloud/hooks/bigquery.py
Line 163 in 00cd44e
airflow/airflow/providers/google/common/hooks/base_google.py
Line 307 in 00cd44e
self.scopes()
airflow/airflow/providers/google/common/hooks/base_google.py
Line 290 in 00cd44e
_get_scopes()
)airflow/airflow/providers/google/common/hooks/base_google.py
Line 414 in 00cd44e
Possible alternative solutions
scopes()
definition in custom hook - as detailed in above issue BigQuery with impersonation_chain does not accept custom scopes #33400 (comment)scopes
- it would be confusing what takes precedence if there is scopes in parameter and connectionI would need some help testing and bringing this over the finish line
Should be able to do something like