Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support RANGE in schema #1746

Merged
merged 19 commits into from
Jan 8, 2024
Merged

feat: support RANGE in schema #1746

merged 19 commits into from
Jan 8, 2024

Conversation

Linchin
Copy link
Contributor

@Linchin Linchin commented Dec 7, 2023

part of #1724

  • add class FieldElementType to support RANGE type in schema
  • add related unit tests

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)

@Linchin Linchin requested review from a team as code owners December 7, 2023 22:01
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery API. labels Dec 7, 2023
@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 8, 2023
@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 8, 2023
@Linchin
Copy link
Contributor Author

Linchin commented Dec 8, 2023

test failures seem to be api call timeout.

@Linchin Linchin added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 8, 2023
@Linchin Linchin requested a review from parthea December 8, 2023 21:48
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 8, 2023
Copy link
Contributor

@shollyman shollyman left a comment

Choose a reason for hiding this comment

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

Probably worth augmenting a system test to create a table with a RANGE type in the schema, but LGTM otherwise.

@Linchin Linchin requested a review from shollyman January 5, 2024 18:29
@Linchin
Copy link
Contributor Author

Linchin commented Jan 5, 2024

@shollyman After adding the system test, I also had to make a bunch of other changes. Please take another look, thank you :)

self._properties["type"] = element_type.upper()

@property
def element_type(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you also need a setter for this property? Or you're only exposing a setter from the containing type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I decided to not allow the element type to be altered in order to protect the table schema from being changed unintentionally. As a reference, most of the properties in class SchemaField don't have setters either.

google/cloud/bigquery/schema.py Outdated Show resolved Hide resolved
@@ -1804,6 +1799,11 @@ def test_dbapi_fetch_w_bqstorage_client_large_result_set(self):
("id", 3),
("timestamp", datetime.datetime(2006, 10, 9, 18, 40, 33, tzinfo=UTC)),
],
[
Copy link
Contributor

Choose a reason for hiding this comment

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

Not clear how the changes in this file relate to the feature. Just a side fixup?

Copy link
Contributor Author

@Linchin Linchin Jan 5, 2024

Choose a reason for hiding this comment

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

The expected value was changed because the public table somehow lost the first row of the table (id=1) around 12/31, so the system test has been failing.

I have also notified the team managing the public datasets.

@Linchin Linchin requested a review from shollyman January 5, 2024 22:45
@Linchin Linchin merged commit 8585747 into googleapis:main Jan 8, 2024
19 checks passed
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 googleapis/python-bigquery API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants