- Notifications
You must be signed in to change notification settings - Fork321
feat: Addtable_constraints field to Table model#1755
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View thisfailed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
chalmerlowe commentedDec 15, 2023
@dimkonko Please see the note above about the CLA. We will need that taken care of to proceed.#1755 (comment) |
chalmerlowe left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks for all this hard work. I appreciate the time and effort.
I would like to request several changes that I hope you can help with. If you need assistance or want to talk anything through, please let us know.
google/cloud/bigquery/table.py Outdated
| def__eq__(self,other): | ||
| ifnotisinstance(other,PrimaryKey): | ||
| raiseNotImplementedError |
chalmerloweDec 15, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We have several areas of code that coverage.py does not believe are being tested. Those lines of code are:
- 2968
- 2985-2987
- 3019
For line 2968, it does not appear that we have a test that specifically exercises theraise statement by trying to compare an input value that is not a PrimaryKey.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Yep, I missed the coverage part 😅 Thank you for pointing that out. I've added missing coverage in commit29d1238
google/cloud/bigquery/table.py Outdated
| def__eq__(self,other): | ||
| ifnotisinstance(other,PrimaryKey): | ||
| raiseNotImplementedError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
My understanding from the Python documentation is that:
TypeError: Is raised when an operation or function is applied to an object of inappropriate type. The associated value is a string giving details about the type mismatch.
This exception may be raised by user code to indicate that an attempted operation on an object is not supported, and is not meant to be. If an object is meant to support a given operation but has not yet provided an implementation,NotImplementedError is the proper exception to raise.
Passing arguments of the wrong type (e.g. passing a list when an int is expected) should result in aTypeError, but passing arguments with the wrong value (e.g. a number outside expected boundaries) should result in aValueError.
| raiseNotImplementedError | |
| raiseTypeError("The value provided is not a BigQuery PrimaryKey.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@chalmerlowe oh, right. Thank you. I missed that. It should bereturn but notraise.
I think we should notraise anything here to not cause errors and to be consistent with the existing code.
| ifnotisinstance(other,ColumnReference): | ||
| raiseNotImplementedError | ||
| return ( | ||
| self.referenced_column==other.referencing_column | ||
| andself.referenced_column==other.referenced_column | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
For this portion of the mod (2985-2987), coverage.py indicates that we are not exercising this code fully.
We do have tests that reference ColumnReferences, but not necessarily in a way that fully exercises each line of this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Thanks. I've addedcolumn_references to the__eq__ in commitda663b2
| self.column_references=column_references | ||
| def__eq__(self,other): | ||
| ifnotisinstance(other,ForeignKey): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This (3019) is also identified by coverage.py as being untested
google/cloud/bigquery/table.py Outdated
| def__eq__(self,other): | ||
| ifnotisinstance(other,ForeignKey): | ||
| raiseNotImplementedError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Change allNotImplementedErrors as noted in the previous comment to look similar to this:
TypeError("<add a suitable message for the user to figure out the problem.")
table_constraints field to Table modeltable_constraints field to Table modelUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
chalmerlowe left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM.
@dimkonko
Thanks for all your hard work pulling this together and thanks for your patience as I worked through the review process. I am grateful for your time and effort.
Uh oh!
There was an error while loading.Please reload this page.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes#1754 🦕