8000 BigQuery: Add support for unsetting LoadJobConfig schema by plamut · Pull Request #9077 · googleapis/google-cloud-python · GitHub
[go: up one dir, main page]

Skip to content

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 a team and tswast 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

0