Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
chalmerlowe merged 31 commits intogoogleapis:mainfromdimkonko:main
Jan 11, 2024

Conversation

@dimkonko
Copy link
Contributor

@dimkonkodimkonko commentedDec 14, 2023
edited by chalmerlowe
Loading

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:

  • Make sure to open an issue as abug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes#1754 🦕

@google-cla
Copy link

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.

@product-auto-labelproduct-auto-labelbot added size: mPull request size is medium. api: bigqueryIssues related to the googleapis/python-bigquery API. labelsDec 14, 2023
@chalmerlowe
Copy link
Collaborator

@dimkonko
I am reviewing this PR. Thank you for the hard work you have put in. I appreciate it. I would like to work with you to get this merged. I have reviewed the PR and will be making a few comments on some of the code shortly.

Please see the note above about the CLA. We will need that taken care of to proceed.#1755 (comment)

@chalmerlowechalmerlowe added kokoro:runAdd this label to force Kokoro to re-run the tests. kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelsDec 15, 2023
@yoshi-kokoroyoshi-kokoro removed kokoro:runAdd this label to force Kokoro to re-run the tests. kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelsDec 15, 2023
Copy link
Collaborator

@chalmerlowechalmerlowe left a comment

Choose a reason for hiding this comment

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

@dimkonko

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.


def__eq__(self,other):
ifnotisinstance(other,PrimaryKey):
raiseNotImplementedError
Copy link
Collaborator

@chalmerlowechalmerloweDec 15, 2023
edited
Loading

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.

Copy link
ContributorAuthor

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


def__eq__(self,other):
ifnotisinstance(other,PrimaryKey):
raiseNotImplementedError
Copy link
Collaborator

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.

Suggested change
raiseNotImplementedError
raiseTypeError("The value provided is not a BigQuery PrimaryKey.")

Copy link
ContributorAuthor

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.

Comment on lines 2985 to 2990
ifnotisinstance(other,ColumnReference):
raiseNotImplementedError
return (
self.referenced_column==other.referencing_column
andself.referenced_column==other.referenced_column
)
Copy link
Collaborator

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.

Copy link
ContributorAuthor

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):
Copy link
Collaborator

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


def__eq__(self,other):
ifnotisinstance(other,ForeignKey):
raiseNotImplementedError
Copy link
Collaborator

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.")

@product-auto-labelproduct-auto-labelbot added size: lPull request size is large. and removed size: mPull request size is medium. labelsDec 16, 2023
@dimkonkodimkonko changed the titleAddtable_constraints field to Table modelfeat: Addtable_constraints field to Table modelDec 16, 2023
@kiraksikiraksi added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelDec 19, 2023
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelDec 19, 2023
@chalmerlowechalmerlowe added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 8, 2024
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 8, 2024
@chalmerlowechalmerlowe added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 8, 2024
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 8, 2024
@chalmerlowechalmerlowe added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 8, 2024
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 8, 2024
@chalmerlowechalmerlowe added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 8, 2024
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 8, 2024
@chalmerlowechalmerlowe added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 9, 2024
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 9, 2024
Copy link
Collaborator

@chalmerlowechalmerlowe left a 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.

dimkonko reacted with rocket emoji
@chalmerlowechalmerlowe added the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 11, 2024
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-runAdd this label to force Kokoro to re-run the tests. labelJan 11, 2024
@chalmerlowechalmerlowe merged commita167f9a intogoogleapis:mainJan 11, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@chalmerlowechalmerlowechalmerlowe approved these changes

@nayaknishantnayaknishantAwaiting requested review from nayaknishantnayaknishant was automatically assigned from googleapis/api-bigquery

Assignees

@chalmerlowechalmerlowe

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.size: lPull request size is large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add table_constraints field to Table model

4 participants

@dimkonko@chalmerlowe@yoshi-kokoro@kiraksi

[8]ページ先頭

©2009-2025 Movatter.jp