Skip to content

Conversation

@josh-fell
Copy link
Contributor

Closes: #20333

Currently there is a datatype check on source_objects within the GCSToBigQueryOperator.__init__() method. This is a template field for the operator. If a user tries to pass in an XCom value that will be rendered as a list (i.e. render_template_as_native_obj=True at the DAG level), the datatype check incorrectly assumes the value is a string and wraps the value in a list. When the XCom value is then rendered during execute() the value becomes a List[List] instead of the desired List type.

Moving this datatype check into the execute() method of the operator will allow any template rendering to occur before the check is performed.


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

@josh-fell josh-fell requested a review from turbaszek as a code owner December 16, 2021 16:58
@boring-cyborg boring-cyborg bot added area:providers provider:google Google (including GCP) related issues labels Dec 16, 2021
Copy link
Member

@potiuk potiuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice find!

@github-actions
Copy link

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.

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Dec 16, 2021
@potiuk potiuk merged commit 17404f1 into apache:main Dec 16, 2021
@josh-fell josh-fell deleted the fix-20333-gcstobqop-source-objects-rendering branch December 16, 2021 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers okay to merge It's ok to merge this PR as it does not require more tests provider:google Google (including GCP) related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GCSToBigQueryOperator not rendering list pulled from XCOM

2 participants