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 — Breaking Change: update model.py classes to use proto-plus instead of _pb · Issue #319 · googleapis/python-bigquery

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

Breaking Change: update model.py classes to use proto-plus instead of _pb #319

Copy link
Copy link
Closed
Closed
Breaking Change: update model.py classes to use proto-plus instead of _pb#319
Copy link
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.semver: majorHint for users that this is an API breaking change.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Description

@tswast
tswast
opened on Oct 12, 2020
Issue body actions

Currently the classes in model.py use the underlying protobuf _pb object for read-only properties instead of the proto-plus object.

python-bigquery/google/cloud/bigquery/model.py

Line 58 in b8f502b

self._proto = types.Model()._pb

This avoided some possible breaking changes, but was mostly done to expedite the transition to the microgenerator.

There are some benefits to using proto-plus that would be worth taking advantage of. Most importantly, timestamp well-known types are properly translated into a datetime-like object with proto-plus.

Why now?

There are some breaking changes in the latest generated clients due to googleapis/gapic-generator-python#595

  • https://github.com/googleapis/python-bigquery/pull/316/files#diff-daa390c4795c10c42d5e8cec48f5339c

If we need to make a breaking change for these changes, we might as well update the classes to support the latest versions.

Activity

  1. tswast
    assigned
    cguardia
    on Oct 12, 2020
  2. product-auto-label
    added
    api: bigqueryIssues related to the googleapis/python-bigquery API.
    on Oct 12, 2020
  3. tswast
    added
    semver: majorHint for users that this is an API breaking change.
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    on Oct 12, 2020
  4. cguardia commented on Oct 29, 2020

    @cguardia
    cguardia
    on Oct 29, 2020
    Contributor
    More actions

    @tswast After getting a bit more work done here, I saw that routine also uses _pb, so I started to look at getting rid of it there too:

    https://github.com/googleapis/python-bigquery/blob/master/google/cloud/bigquery/routine.py#L202

    When the line above runs, resource is equal to {'typeKind': 'INT64'}. If I replace that line with e.g. resource = type(value).to_dict(value), resource is {'type_kind': 2}.

    This is an example of the kind of under the hood name and type conversion that json_format does. There are more than a few tests that take this for granted, not only in model code, but also in client code. The problem is that some actual code outside of the tests also relies on this on occasion, so when I tried my initial approach to change to snake_case wholesale, I sometimes ended up with half a dozen more failing tests after making a change to correct the case of a single different test.

    I'm working on this still, but I wanted to describe this issue that has complicated the work a bit.

  5. tswast
    unassigned
    cguardia
    on Jul 20, 2021
  6. tswast commented on Jul 20, 2021

    @tswast
    tswast
    on Jul 20, 2021
    ContributorAuthor
    More actions

    Alternatively, we could switch to returning dictionaries for these BigQuery ML classes. The proto definitions aren't republished as often as I first anticipated, as it's a manual process.

  7. tswast commented on Jul 20, 2021

    @tswast
    tswast
    on Jul 20, 2021
    ContributorAuthor
    More actions

    Dictionaries would be a worse experience from an IDE and docs perspective, though.

  8. tswast commented on Jul 26, 2021

    @tswast
    tswast
    on Jul 26, 2021
    ContributorAuthor
    More actions

    Closing in favor of #814

  9. tswast
    closed this as completedon Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigqueryIssues related to the googleapis/python-bigquery API.semver: majorHint for users that this is an API breaking change.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      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.