GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: adding property setter for table constraints, #1990 by lkhagvadorj-amp · Pull Request #2092 · googleapis/python-bigquery

This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Conversation

@lkhagvadorj-amp

@lkhagvadorj-amp lkhagvadorj-amp commented Dec 20, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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 a bug/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 #1990 🦕


Overview

This pull request introduces enhancements to the google/cloud/bigquery/table.py file by adding setter methods and conversion functions. Additionally, a new unit test is added to ensure the functionality of the new setter method.

Enhancements to google/cloud/bigquery/table.py:

  • Added a setter method for table_constraints to allow setting primary key and foreign key information.
  • Added to_api_repr method to the ForeignKey class to return a dictionary representation of the object.
  • Added to_api_repr method to the TableConstraints class to return a dictionary representation of the object.

Unit tests:

  • Added a test for the table_constraints property setter to ensure it correctly updates the table properties.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

enkhjile reacted with rocket emoji
All reactions
  • 🚀 1 reaction
@lkhagvadorj-amp
lkhagvadorj-amp requested review from a team and mrfaizal December 20, 2024 18:07
@google-cla

google-cla Bot commented Dec 20, 2024

Copy link
Copy Markdown

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 this failed 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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@product-auto-label product-auto-label Bot added the size: m Pull request size is medium. label Dec 20, 2024
@blunderbuss-gcf blunderbuss-gcf Bot assigned chalmerlowe Dec 20, 2024
@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Dec 20, 2024
@Linchin Linchin added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Dec 20, 2024
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Dec 20, 2024
@Linchin

Linchin commented Dec 20, 2024

Copy link
Copy Markdown
Contributor

Thank you @lkhagvadorj-amp for making the contribution! The PR looks great, but could you do the following things so we can merge it:

  1. sign the CLA because it's part of the legal requirements
  2. add some unit tests: unit tests for both to_api_repr() methods, and more test cases for the setter, for 100% test coverage
  3. add a system test for this property

Thanks again and happy holidays!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@product-auto-label product-auto-label Bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Dec 22, 2024
@lkhagvadorj-amp

lkhagvadorj-amp commented Dec 23, 2024

Copy link
Copy Markdown
Contributor Author

@Linchin
Hi

Happy to contribute and thank you for the initial review!

I’ve pushed the testing changes—would be grateful if you could review them again.

Happy holidays!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Linchin Linchin added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Dec 30, 2024
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Dec 30, 2024
@Linchin Linchin assigned Linchin and unassigned chalmerlowe Jan 2, 2025
Linchin
Linchin reviewed Jan 2, 2025
View reviewed changes
Comment thread google/cloud/bigquery/table.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Linchin

Linchin commented Jan 2, 2025

Copy link
Copy Markdown
Contributor

Thank you @lkhagvadorj-amp, I ran the test again, but it seems we need to fix several tests. I'm sorry that I have to trigger the presubmit tests manually, but you can run the system test locally by pytest tests/system/test_client.py, the lint test by nox -s lint, and mypy_samples test by nox -s mypy_samples. (You can install nox by pip install nox.)

lkhagvadorj-amp reacted with rocket emoji
All reactions
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jmesterh

jmesterh commented Feb 14, 2025

Copy link
Copy Markdown

Is this PR dead? Constraints are required for BigQuery CDC to function.

lkhagvadorj-amp reacted with laugh emoji
All reactions
  • 😄 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lkhagvadorj-amp

lkhagvadorj-amp commented Feb 14, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@jmesterh
Thank you for reminder.

I will work on this change on this weekend.
My apologies for late fixing. :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lkhagvadorj-amp
lkhagvadorj-amp force-pushed the feat/table-constraints-property-setter branch from b646533 to 3dcbeea Compare February 21, 2025 11:38
@lkhagvadorj-amp
lkhagvadorj-amp requested a review from a team as a code owner February 21, 2025 11:38
@lkhagvadorj-amp
lkhagvadorj-amp requested a review from leahecole February 21, 2025 11:38
@lkhagvadorj-amp
lkhagvadorj-amp force-pushed the feat/table-constraints-property-setter branch 2 times, most recently from dd2c5ed to 62028bc Compare February 21, 2025 11:49
@lkhagvadorj-amp
lkhagvadorj-amp requested a review from Linchin February 23, 2025 16:01
@lkhagvadorj-amp

lkhagvadorj-amp commented Feb 23, 2025

Copy link
Copy Markdown
Contributor Author

@Linchin
Hi , hope you're doing well! 👋

Could you please take another look at my PR when you get a chance?
Sorry about the many commits—I'll make sure to keep it cleaner next time. Thanks so much for your time! 🙏

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Linchin Linchin added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Feb 24, 2025
@kokoro-team kokoro-team removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Feb 24, 2025
Linchin
Linchin reviewed Feb 24, 2025
View reviewed changes
Comment thread google/cloud/bigquery/table.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Linchin
Linchin reviewed Feb 24, 2025
View reviewed changes
Comment thread google/cloud/bigquery/table.py
def __eq__(self, other):
if not isinstance(other, TableConstraints) and other is not None:
raise TypeError("The value provided is not a BigQuery TableConstraints.")
return (

@Linchin Linchin Feb 24, 2025

Copy link
Copy Markdown
Contributor

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.

I think we need to add a test case for this case

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@lkhagvadorj-amp lkhagvadorj-amp Feb 25, 2025

Copy link
Copy Markdown
Contributor Author

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.

added more test on eq under unit test

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Linchin

Linchin commented Feb 24, 2025

Copy link
Copy Markdown
Contributor

Hi @lkhagvadorj-amp thanks for updating the PR, from the tests it seems we need some additional test coverage, and need to fix linting. Could you update the PR so we can pass these tests?

We are in the process of migrating our testing infra so there's a confusingly large number of tests that are failing, but for now the only ones that matter are "Kokoro" and "Kokoro linting-typing", and you can ignore the rest.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lkhagvadorj-amp
fix: adding table constraint eq unit tests
0a4cc9d
@Linchin Linchin added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Feb 25, 2025
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Feb 25, 2025
@Linchin

Linchin commented Feb 25, 2025

Copy link
Copy Markdown
Contributor

Thanks @lkhagvadorj-amp, there's still a test failing in linting, could you fix it too? Here's the message:

nox > mypy -p google --show-traceback
google/cloud/bigquery/table.py:3473: error: Incompatible types in assignment (expression has type "List[Dict[str, Any]]", target has type "Dict[str, List[str]]")  [assignment]
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lkhagvadorj-amp added 2 commits March 3, 2025 21:57
@lkhagvadorj-amp
fix: adding type to to_api_repr resource
42a80cd
@lkhagvadorj-amp
Merge branch 'main' into feat/table-constraints-property-setter
1fdbdbe
@lkhagvadorj-amp

lkhagvadorj-amp commented Mar 3, 2025

Copy link
Copy Markdown
Contributor Author

@Linchin
Hi thank you!
Fixed on linting error (mypy check).

Please let me know if you have any additional comments.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lkhagvadorj-amp
lkhagvadorj-amp requested a review from Linchin March 3, 2025 22:00
@Linchin Linchin added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Mar 4, 2025
@kokoro-team kokoro-team removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Mar 4, 2025
Linchin
Linchin approved these changes Mar 4, 2025
View reviewed changes

@Linchin Linchin left a comment

Copy link
Copy Markdown
Contributor

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, thank you for your contribution!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Linchin
Linchin merged commit f8572dd into googleapis:main Mar 4, 2025
@release-please release-please Bot mentioned this pull request Mar 4, 2025
chore(main): release 3.31.0 #2139
Merged
@lkhagvadorj-amp

lkhagvadorj-amp commented Mar 5, 2025

Copy link
Copy Markdown
Contributor Author

@Linchin
Yeaay!

My apologies for too many commits and looping again and again.

Happy to contribute!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Apr 1, 2025
March 31, 2025 kitta65/bq-extension-vscode#709
Closed
March 31, 2025 kitta65/prettier-plugin-bq#626
Closed
March 31, 2025 kitta65/bq2cst#493
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@mrfaizal mrfaizal Awaiting requested review from mrfaizal
@leahecole leahecole Awaiting requested review from leahecole leahecole was automatically assigned from googleapis/python-samples-owners
1 more reviewer
@Linchin Linchin Linchin approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@Linchin Linchin

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. size: l Pull request size is large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

table_constraints has no setter?

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@lkhagvadorj-amp @Linchin @jmesterh @chalmerlowe @kokoro-team @yoshi-kokoro
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.