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
BigQueryInsertJobOperator
in deferrable mode in regions other thanEU
,US
orus-central1
. This fix was provided now because there is no response neither fromgcloud-aio
norgoogle-cloud-bigquery
regarding their plans for providing async get_job method with the optionallocation
parameter.The proposed solution:
BigQueryAsyncHook
wraps the call of the synchronous methodBigQueryAsyncHook.get_job()
inasyncio.loop.run_in_executor()
.location
is passed from theBigQueryInsertJobOperator
to theBigQueryInsertJobTrigger
, where it is handed to the hook.BigQueryInsertJobTrigger
is 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 parameterlocation
is ignored there. However, it would be very nice to fix them too and test carefully in a separated PR:closes: #35833