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 — feat: accept TableListItem where TableReference is accepted by steffnay · Pull Request #1016 · googleapis/python-bigquery

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

Conversation

@steffnay

@steffnay steffnay commented Oct 11, 2021

Copy link
Copy Markdown
Contributor

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)

🦕

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@steffnay
feat: accept TableListItem where TableReference is accepted
5bcaa92
@steffnay
steffnay requested review from a team and shollyman October 11, 2021 21:46
@product-auto-label product-auto-label Bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Oct 11, 2021
@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 11, 2021
@tswast

tswast commented Oct 11, 2021

Copy link
Copy Markdown
Contributor

Looks like we need to either update the test_get_iam_policy_w_invalid_table test to look for ValueError or update _parse_3_part_id to raise TypeError.

Based on https://docs.python.org/3/library/exceptions.html#TypeError, I think ValueError is more accurate.

________________ TestClient.test_get_iam_policy_w_invalid_table ________________

self = <tests.unit.test_client.TestClient testMethod=test_get_iam_policy_w_invalid_table>

    def test_get_iam_policy_w_invalid_table(self):
        creds = _make_credentials()
        http = object()
        client = self._make_one(project=self.PROJECT, credentials=creds, _http=http)

        table_resource_string = "projects/{}/datasets/{}/tables/{}".format(
            self.PROJECT, self.DS_ID, self.TABLE_ID,
        )

        with self.assertRaises(TypeError):
>           client.get_iam_policy(table_resource_string)

tests/unit/test_client.py:1558:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
google/cloud/bigquery/client.py:813: in get_iam_policy
    table = _table_arg_to_table_ref(table, default_project=self.project)
google/cloud/bigquery/table.py:2666: in _table_arg_to_table_ref
    value = TableReference.from_string(value, default_project=default_project)
google/cloud/bigquery/table.py:252: in from_string
    ) = _helpers._parse_3_part_id(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def _parse_3_part_id(full_id, default_project=None, property_name="table_id"):
        output_project_id = default_project
        output_dataset_id = None
        output_resource_id = None
        parts = _split_id(full_id)

        if len(parts) != 2 and len(parts) != 3:
>           raise ValueError(
                "{property_name} must be a fully-qualified ID in "
                'standard SQL format, e.g., "project.dataset.{property_name}", '
                "got {}".format(full_id, property_name=property_name)
            )
E           ValueError: table_id must be a fully-qualified ID in standard SQL format, e.g., "project.dataset.table_id", got projects/PROJECT/datasets/DATASET_ID/tables/TABLE_ID

google/cloud/bigquery/_helpers.py:848: ValueError
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

steffnay and others added 3 commits October 12, 2021 13:10
@steffnay
Merge branch 'main' of github.com:googleapis/python-bigquery into acc…
f830a02
…ept-TLI
@steffnay
update unit test
297f9a3
@steffnay
Merge branch 'main' into accept-TLI
eca2789
tswast
tswast suggested changes Oct 13, 2021
View reviewed changes
Comment thread google/cloud/bigquery/client.py Outdated
raise TypeError("table must be a Table or TableReference")
table = _table_arg_to_table_ref(table, default_project=self.project)
if not isinstance(table, (TableReference)):
raise TypeError(

@tswast tswast Oct 13, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Need unit test that covers this. Possibly this if statement can be deleted if _table_arg_to_table_ref already throws?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

steffnay reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
Comment thread google/cloud/bigquery/client.py Outdated
raise TypeError("table must be a Table or TableReference")
table = _table_arg_to_table_ref(table, default_project=self.project)
if not isinstance(table, (TableReference)):
raise TypeError(

@tswast tswast Oct 13, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Line not covered in unit tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@steffnay steffnay Oct 26, 2021

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ah, got it! Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/bigquery/client.py Outdated
raise TypeError("table must be a Table or TableReference")
table = _table_arg_to_table_ref(table, default_project=self.project)
if not isinstance(table, (TableReference)):
raise TypeError(

@tswast tswast Oct 13, 2021

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Line not covered in unit tests

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
steffnay and others added 2 commits October 26, 2021 10:46
@steffnay
Merge branch 'main' into accept-TLI
0c1214b
@steffnay
remove raise
9467abc
@steffnay
steffnay requested a review from tswast October 26, 2021 19:49
steffnay and others added 3 commits October 27, 2021 11:21
@steffnay
Merge branch 'main' into accept-TLI
8775658
@steffnay
Merge branch 'main' into accept-TLI
86f7c87
@tswast
Merge branch 'main' into accept-TLI
9b6c908
tswast
tswast approved these changes Nov 1, 2021
View reviewed changes
@tswast tswast added the automerge Merge the pull request once unit tests and other checks pass. label Nov 1, 2021
@gcf-merge-on-green
gcf-merge-on-green Bot merged commit fe16adc into googleapis:main Nov 1, 2021
@gcf-merge-on-green gcf-merge-on-green Bot removed the automerge Merge the pull request once unit tests and other checks pass. label Nov 1, 2021
gcf-merge-on-green Bot pushed a commit that referenced this pull request Nov 3, 2021
@release-please
chore: release 2.30.0 (#1039)
7c5fa8a
🤖 I have created a release \*beep\* \*boop\*
---
## [2.30.0](https://www.github.com/googleapis/python-bigquery/compare/v2.29.0...v2.30.0) (2021-11-03)


### Features

* accept TableListItem where TableReference is accepted ([#1016](https://www.github.com/googleapis/python-bigquery/issues/1016)) ([fe16adc](https://www.github.com/googleapis/python-bigquery/commit/fe16adc86a170d0992c32091b349b036f8b43884))
* support Python 3.10 ([#1043](https://www.github.com/googleapis/python-bigquery/issues/1043)) ([5bbb832](https://www.github.com/googleapis/python-bigquery/commit/5bbb832a83ebb66db4b5ee740cdfc53f4df8430b))


### Documentation

* add code samples for Jupyter/IPython magics ([#1013](https://www.github.com/googleapis/python-bigquery/issues/1013)) ([61141ee](https://www.github.com/googleapis/python-bigquery/commit/61141ee0634024ad261d1595c95cd14a896fb87e))
* **samples:** add create external table with hive partitioning  ([#1033](https://www.github.com/googleapis/python-bigquery/issues/1033)) ([d64f5b6](https://www.github.com/googleapis/python-bigquery/commit/d64f5b682854a2293244426316890df4ab1e079e))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
@release-please release-please Bot mentioned this pull request Jan 4, 2022
chore(main): release python-bigquery 1.27.1 #1097
Closed
abdelmegahedgoogle pushed a commit to abdelmegahedgoogle/python-bigquery that referenced this pull request Apr 17, 2023
@steffnay @abdelmegahedgoogle
feat: accept TableListItem where TableReference is accepted (googleap…
fe39169
…is#1016)

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](https://github.com/googleapis/python-bigquery/issues/new/choose) 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)

🦕
abdelmegahedgoogle pushed a commit to abdelmegahedgoogle/python-bigquery that referenced this pull request Apr 17, 2023
@release-please @abdelmegahedgoogle
chore: release 2.30.0 (googleapis#1039)
5bcff87
🤖 I have created a release \*beep\* \*boop\*
---
## [2.30.0](https://www.github.com/googleapis/python-bigquery/compare/v2.29.0...v2.30.0) (2021-11-03)


### Features

* accept TableListItem where TableReference is accepted ([googleapis#1016](https://www.github.com/googleapis/python-bigquery/issues/1016)) ([fe16adc](https://www.github.com/googleapis/python-bigquery/commit/fe16adc86a170d0992c32091b349b036f8b43884))
* support Python 3.10 ([googleapis#1043](https://www.github.com/googleapis/python-bigquery/issues/1043)) ([5bbb832](https://www.github.com/googleapis/python-bigquery/commit/5bbb832a83ebb66db4b5ee740cdfc53f4df8430b))


### Documentation

* add code samples for Jupyter/IPython magics ([googleapis#1013](https://www.github.com/googleapis/python-bigquery/issues/1013)) ([61141ee](https://www.github.com/googleapis/python-bigquery/commit/61141ee0634024ad261d1595c95cd14a896fb87e))
* **samples:** add create external table with hive partitioning  ([googleapis#1033](https://www.github.com/googleapis/python-bigquery/issues/1033)) ([d64f5b6](https://www.github.com/googleapis/python-bigquery/commit/d64f5b682854a2293244426316890df4ab1e079e))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@shollyman shollyman Awaiting requested review from shollyman
1 more reviewer
@tswast tswast tswast approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: bigquery Issues related to the googleapis/python-bigquery API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@steffnay @tswast
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.