GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feature: raise error for unknown properties in job config by cguardia · Pull Request #446 · googleapis/python-bigquery
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
Conversation
|
| def __setattr__(self, name, value): | ||
| """Override to be able to warn if an uknown property is being set""" | ||
| if not name.startswith("_") and name not in type(self).__dict__: | ||
| warnings.warn("Property {} is unknown for {}.".format(name, type(self))) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
On second thought, I think we can go a step further and throw AttributeError, just like object() instances do.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
OK. Done.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It appears you've uncovered a bug in the client. I don't see a setter for labels!
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Nevermind, there is a setter:
Perhaps this logic needs to be adjusted in order to account for properties defined in the superclass? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| def __setattr__(self, name, value): | ||
| """Override to be able to raise error if an unknown property is being set""" | ||
| if not name.startswith("_") and name not in type(self).__dict__: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Let's try using hasattr to see if that accounts for superclass properties.
| if not name.startswith("_") and name not in type(self).__dict__: | |
| if not name.startswith("_") and not hasattr(self, name): |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ok, but we have to use type(self), because if not the properties are looked up on the instance.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
One of our system tests actually had a mistake, which this change caught. There is no "destination" property on LoadJobConfig https://googleapis.dev/python/bigquery/latest/generated/google.cloud.bigquery.job.LoadJobConfig.html |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Re: labels error - as discussed offline, it's actually a bug in the base |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
As far as I can tell, this has never been a valid config value here. But prior to the merging of [this PR][1] in v2.7.0, invalid attributes were silently ignored. [1]: googleapis/python-bigquery#446
As far as I can tell, this has never been a valid config value here. But prior to the merging of [this PR][1] in v2.7.0, invalid attributes were silently ignored. [1]: googleapis/python-bigquery#446
As far as I can tell, this has never been a valid config value here. But prior to the merging of [this PR][1] in v2.7.0, invalid attributes were silently ignored. [1]: googleapis/python-bigquery#446
As far as I can tell, this has never been a valid config value here. But prior to the merging of [this PR][1] in v2.7.0, invalid attributes were silently ignored. [1]: googleapis/python-bigquery#446
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Resource objects such as *JobConfig do not error or warn when setting unknown properties
There was an error while loading. Please reload this page.