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

feat: support RANGE in schema - #1746

Merged
Linchin merged 19 commits into
googleapis:mainfrom
Linchin:range_schema
Jan 8, 2024
Merged

feat: support RANGE in schema#1746
Linchin merged 19 commits into
googleapis:mainfrom
Linchin:range_schema

Conversation

@Linchin

@LinchinLinchin commented Dec 7, 2023

Copy link
Copy Markdown
Contributor

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, PhongChuong and shollymanDecember 7, 2023 22:01
@product-auto-labelproduct-auto-labelBot added size: m Pull request size is medium. api: bigquery Issues related to the googleapis/python-bigquery API. labels Dec 7, 2023
@LinchinLinchin mentioned this pull request Dec 7, 2023
6 tasks
Comment threadgoogle/cloud/bigquery/schema.py Outdated
@LinchinLinchin 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-kokoroyoshi-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
Copy Markdown
ContributorAuthor

test failures seem to be api call timeout.

@LinchinLinchin 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 partheaDecember 8, 2023 21:48
@yoshi-kokoroyoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Dec 8, 2023

@shollymanshollyman left a comment

Copy link
Copy Markdown
Contributor

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 shollymanJanuary 5, 2024 18:29
@Linchin

Copy link
Copy Markdown
ContributorAuthor

@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
Copy Markdown
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
Copy Markdown
ContributorAuthor

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.

Comment threadgoogle/cloud/bigquery/schema.py Outdated
("id", 3),
("timestamp", datetime.datetime(2006, 10, 9, 18, 40, 33, tzinfo=UTC)),
],
[

Copy link
Copy Markdown
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?

@LinchinLinchinJan 5, 2024

Copy link
Copy Markdown
ContributorAuthor

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 shollymanJanuary 5, 2024 22:45
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Linchin@shollyman@parthea@yoshi-kokoro