Support location for BigQueryInsertJobOperator in deferrable mode #37282
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR provides a workaround solution for the issue #35833.
It is really necessary because users are unable to use
BigQueryInsertJobOperatorin deferrable mode in regions other thanEU,USorus-central1. This fix was provided now because there is no response neither fromgcloud-aionorgoogle-cloud-bigqueryregarding their plans for providing async get_job method with the optionallocationparameter.The proposed solution:
BigQueryAsyncHookwraps the call of the synchronous methodBigQueryAsyncHook.get_job()inasyncio.loop.run_in_executor().locationis passed from theBigQueryInsertJobOperatorto theBigQueryInsertJobTrigger, where it is handed to the hook.BigQueryInsertJobTriggeris a parent class for other four triggers (see below), they were updated in order to comply with the base class attributes.BigQueryAsyncHook.get_job_status()don;t change behavior because the optional parameterlocationis ignored there. However, it would be very nice to fix them too and test carefully in a separated PR:closes: #35833