Skip to content
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

BigQuery: Add support for unsetting LoadJobConfig schema #9077

Merged
merged 1 commit into from
Aug 22, 2019

Conversation

plamut
Copy link
Contributor

@plamut plamut commented Aug 22, 2019

Closes #9074.

This PR adds a public way of unsetting a schema from a LoadJobConfig.

How to test

Create a LoadJobConfig with a schema attribute, then set schema to None --> the schema should be cleared.

@plamut plamut added the api: bigquery Issues related to the BigQuery API. label Aug 22, 2019
@plamut plamut requested review from tswast and a team August 22, 2019 11:49
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 22, 2019

config.schema = None
self.assertNotIn("schema", config._properties["load"])
config.schema = None # no error, idempotent operation
Copy link
Contributor Author

@plamut plamut Aug 22, 2019

Choose a reason for hiding this comment

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

This extra assignment is to catch fragile implementations such as
del self._properties["load"]["schema"]

(nope, did not do it myself, but I've seen similar bugs in the past 😆 )

Copy link
Contributor

@tswast tswast left a comment

Choose a reason for hiding this comment

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

Thanks for handling this so quickly!

@tswast tswast merged commit a279630 into googleapis:master Aug 22, 2019
@plamut plamut deleted the iss-9074 branch August 22, 2019 16:18
HemangChothani pushed a commit to HemangChothani/google-cloud-python that referenced this pull request Aug 29, 2019
emar-kar pushed a commit to MaxxleLLC/google-cloud-python that referenced this pull request Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BigQuery: LoadJobConfig.schema setter should accept None
3 participants