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: adds the SerDeInfo class and tests#2108

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 2 commits intomainfromfeat-b358215039-adds-serdeinfo-class
Jan 10, 2025

Conversation

@chalmerlowe
Copy link
Collaborator

This PR adds the SerDeInfo (serializer/deserializer info) class and the associated tests, plus minor tweaks to support both of those changes.

@chalmerlowechalmerlowe requested review froma team ascode ownersJanuary 9, 2025 18:51
@product-auto-labelproduct-auto-labelbot added size: mPull request size is medium. api: bigqueryIssues related to the googleapis/python-bigquery API. labelsJan 9, 2025
classSerDeInfo:
"""Serializer and deserializer information.
Args:
serializationLibrary (str): Required. Specifies a fully-qualified class
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
serializationLibrary (str):Required.Specifiesafully-qualifiedclass
serialization_library (str):Required.Specifiesafully-qualifiedclass

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to transforming to PEP-8 compliantsnake_case

chalmerlowe reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Resolved.

Copy link
Contributor

@tswasttswast left a comment

Choose a reason for hiding this comment

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

Overall approach looks great. A couple nits.

fromgoogle.cloud.bigqueryimport_helpers
fromgoogle.cloud.bigqueryimportstandard_sql
fromgoogle.cloud.bigquery._helpersimport (
_isinstance_or_raise,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Use_helpers._isinstance_or_raise in the code instead.

Use import statements for packages and modules only, not for individual types, classes, or functions.

https://google.github.io/styleguide/pyguide.html#22-imports

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

This is great feedback. I had not realized that.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Resolved.

Comment on lines 566 to 567
"""Serializer and deserializer information.
Args:
Copy link
Contributor

Choose a reason for hiding this comment

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

Might need a blank line here for the docs renderer to work?

Suggested change
"""Serializeranddeserializerinformation.
Args:
"""Serializeranddeserializerinformation.
Args:

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Resolved.

classSerDeInfo:
"""Serializer and deserializer information.
Args:
serializationLibrary (str): Required. Specifies a fully-qualified class
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to transforming to PEP-8 compliantsnake_case

chalmerlowe reacted with thumbs up emoji
Comment on lines 23 to 26
fromgoogle.cloud.bigquery.schemaimport (
PolicyTagList,
SerDeInfo,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
CollaboratorAuthor

@chalmerlowechalmerloweJan 9, 2025
edited
Loading

Choose a reason for hiding this comment

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

Hmm. I attempted to correct this for bothPolicyTagList andSerDeInfo.
Unfortunately, there is something about how PolicyTagList is handled in our code that did not like the change and it produced several failing tests. I did not want to clutter this PR with unrelated changes, nor did I want to delay the issuance of this PR.

So I resolved this in the following way:

  • I correctedSerDeInfo and throughout the code we referenceschema.SerDeInfo.
  • I left the PolicyTagList code exactly as it was found.

tswast reacted with thumbs up emoji
returnanswer


classSerDeInfo:
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the name in the REST API? I'd prefer the full names rather than abbreviations, but I'm OK with this if it's to be consistent with the proto/REST API.

Linchin reacted with thumbs up emoji
Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

SerDeInfo is the name in the proto/REST API definitions.


@property
defserialization_library(self)->Any:
"""Required. Specifies a fully-qualified class name of the serialization
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I thinkRequired. should only apply to the init.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

As mentioned in chat, I prefer to leave this as is.

Linchin reacted with thumbs up emoji

@property
defname(self)->Any:
"""Optional. Name of the SerDe. The maximum length is 256 characters."""
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: similarly, we can removeOptional. here.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

As mentioned in chat, I prefer to leave this as is.

self._properties["serializationLibrary"]=value

@property
defname(self)->Any:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
defname(self)->Any:
defname(self)->Optional[str]:

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Resolved.

self.parameters=parameters

@property
defserialization_library(self)->Any:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
defserialization_library(self)->Any:
defserialization_library(self)->str:

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Resolved.

self._properties["name"]=value

@property
defparameters(self)->Any:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
defparameters(self)->Any:
defparameters(self)->Optional[dict[str,str]]:

For consistent type annotations.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

Resolved.

returnself._properties.get("parameters")

@parameters.setter
defparameters(self,value:Optional[dict[str,str]]=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

See reply above from Python Docs about the concept ofoptional versustyping.Optional.

@LinchinLinchin self-requested a reviewJanuary 10, 2025 18:21
@chalmerlowechalmerlowe merged commit62960f2 intomainJan 10, 2025
19 checks passed
@chalmerlowechalmerlowe deleted the feat-b358215039-adds-serdeinfo-class branchJanuary 10, 2025 18:22
chalmerlowe added a commit that referenced this pull requestJan 22, 2025
* feat: adds SerDeInfo class and tests* cleans up type hints and some minor tweaks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@tswasttswasttswast approved these changes

@LinchinLinchinLinchin approved these changes

@agrawal-siddharthagrawal-siddharthAwaiting requested review from agrawal-siddharthagrawal-siddharth was automatically assigned from googleapis/api-bigquery

Assignees

@tswasttswast

@LinchinLinchin

Labels

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

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@chalmerlowe@tswast@Linchin@alvarowolfx

[8]ページ先頭

©2009-2025 Movatter.jp