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 — refactor AccessEntry to use `_properties` pattern · Issue #1077 · 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.

refactor AccessEntry to use _properties pattern #1077

Copy link
Copy link
Closed
#1125
Closed
refactor AccessEntry to use _properties pattern#1077
#1125
Copy link
Assignees
steffnay
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.type: processA process-related concern. May include testing, release, or the like.

Description

@tswast
tswast
opened on Dec 1, 2021
Issue body actions

Is your feature request related to a problem? Please describe.

Often there is a private preview feature (or just a new feature that we haven't implemented yet) and we want to provide our customers a workaround to be able to send a resource as represented by JSON. Then we could have provided a workaround to the user in #1064 like the following:

entry = AccessEntry.from_api_repr({
  "role": "READER",
  "dataset": {
    "projectId": "project-id",
    "datasetId": "dataset_id",
  }
})

or even

entry = AccessEntry("READER")
entry._properties["dataset"] = {
    "projectId": "project-id",
    "datasetId": "dataset_id",
}

and been confident that it would send the correct values when making the API request.

Likewise, one could read values from the API like entry._properties["dataset"] when checking values from the API.

Describe the solution you'd like

The way we handle entity_type and entity_id is reminiscent of ExternalConfig.options, which I refactored in #994. It was clever at the time when there were only a few external data formats, but has diverged far the actual API representation.

AccessEntry should have separate properties for view, routine, dataset, etc. These could accept and return relevant types (e.g. TableReference) as well.

Existing entity_type and entity_id should be made optional in the constructor, but in the same order so that backwards compatibility is maintained.

Describe alternatives you've considered

Leaving the class as-is should continue to work, but it's a significant risk IMO.

Additional context

As identified in #1075

See similar work in #994

Activity

  1. product-auto-label
    added
    api: bigqueryIssues related to the googleapis/python-bigquery API.
    on Dec 1, 2021
  2. tswast
    added
    type: processA process-related concern. May include testing, release, or the like.
    on Dec 1, 2021
  3. tswast commented on Dec 1, 2021

    @tswast
    tswast
    on Dec 1, 2021
    ContributorAuthor
    More actions

    Eventually, I'd like to see to_api_repr become return copy.deepcopy(self._properties) as we have in our other resource objects, but I proposed a stepping stone in #1075 where we start to_api_repr with resource = copy.deepcopy(self._properties) here:

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

    Line 217 in 3314dfb

    resource = {self._entity_type: self._entity_id}

  4. tswast
    assigned
    steffnay
    on Dec 13, 2021
  5. tswast commented on Dec 13, 2021

    @tswast
    tswast
    on Dec 13, 2021
    ContributorAuthor
    More actions

    Assigning to @steffnay , as I believe she's already done some work on this through #1075

  6. steffnay
    closed this as completedin #1125on Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @steffnay
    steffnay

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.type: processA process-related concern. May include testing, release, or the like.

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.