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: accept TableListItem where TableReference is accepted#1016

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
gcf-merge-on-green merged 9 commits intogoogleapis:mainfromsteffnay:accept-TLI
Nov 1, 2021

Conversation

@steffnay
Copy link
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 abug/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)

🦕

@steffnaysteffnay requested a review froma teamOctober 11, 2021 21:46
@steffnaysteffnay requested a review froma team as acode ownerOctober 11, 2021 21:46
@product-auto-labelproduct-auto-labelbot added the api: bigqueryIssues related to the googleapis/python-bigquery API. labelOct 11, 2021
@google-clagoogle-clabot added the cla: yesThis human has signed the Contributor License Agreement. labelOct 11, 2021
@tswast
Copy link
Contributor

Looks like we need to either update thetest_get_iam_policy_w_invalid_table test to look for ValueError or update_parse_3_part_id to raise TypeError.

Based onhttps://docs.python.org/3/library/exceptions.html#TypeError, I thinkValueError 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_IDgoogle/cloud/bigquery/_helpers.py:848: ValueError

raiseTypeError("table must be a Table or TableReference")
table=_table_arg_to_table_ref(table,default_project=self.project)
ifnotisinstance(table, (TableReference)):
raiseTypeError(
Copy link
Contributor

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?

steffnay reacted with thumbs up emoji
raiseTypeError("table must be a Table or TableReference")
table=_table_arg_to_table_ref(table,default_project=self.project)
ifnotisinstance(table, (TableReference)):
raiseTypeError(
Copy link
Contributor

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

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Ah, got it! Thanks!

raiseTypeError("table must be a Table or TableReference")
table=_table_arg_to_table_ref(table,default_project=self.project)
ifnotisinstance(table, (TableReference)):
raiseTypeError(
Copy link
Contributor

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

@steffnaysteffnay requested a review fromtswastOctober 26, 2021 19:49
@tswasttswast added the automergeMerge the pull request once unit tests and other checks pass. labelNov 1, 2021
@gcf-merge-on-greengcf-merge-on-greenbot merged commitfe16adc intogoogleapis:mainNov 1, 2021
@gcf-merge-on-greengcf-merge-on-greenbot removed the automergeMerge the pull request once unit tests and other checks pass. labelNov 1, 2021
gcf-merge-on-greenbot pushed a commit that referenced this pull requestNov 3, 2021
🤖 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).
abdelmegahedgoogle pushed a commit to abdelmegahedgoogle/python-bigquery that referenced this pull requestApr 17, 2023
…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 requestApr 17, 2023
🤖 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 freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@tswasttswasttswast approved these changes

@shollymanshollymanAwaiting requested review from shollyman

Assignees

No one assigned

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@steffnay@tswast

[8]ページ先頭

©2009-2025 Movatter.jp