Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: accepts a table ID, which downloads the table without a query #443

Merged
merged 22 commits into from
Dec 22, 2021

Conversation

tswast
Copy link
Collaborator

@tswast tswast commented Dec 6, 2021

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)

Fixes #266 🦕

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery-pandas API. label Dec 6, 2021
@tswast tswast marked this pull request as ready for review December 10, 2021 21:50
@tswast tswast requested a review from a team December 10, 2021 21:50
@tswast tswast requested a review from a team as a code owner December 10, 2021 21:50
pandas_gbq/gbq.py Outdated Show resolved Hide resolved
tests/unit/test_gbq.py Outdated Show resolved Hide resolved
Copy link

@plamut plamut left a comment

Choose a reason for hiding this comment

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

Looks good, with just a few nits.

noxfile.py Show resolved Hide resolved
Comment on lines 382 to 384
def download_table(
self, table_id, max_results=None, progress_bar_type=None, dtypes=None
):
Copy link

Choose a reason for hiding this comment

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

(nit) Maybe completely annotate new methods?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call, done.

I probably could have used Dict[str, Any] like we did here for dtypes, but maybe something more specific would be better?

Note: we aren't currently running any sort of type checking in this repo. There's an open issue for it here: #325

Copy link

Choose a reason for hiding this comment

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

For a start, Dict[str, any] is probably just fine, especially if type checks are not implemented yet. Let's just make sure it's consistent with the docstring, the latter currently says Optional[Map[str, Union[str, pandas.Series.dtype]]].

tests/unit/test_gbq.py Outdated Show resolved Hide resolved
@tswast tswast requested a review from plamut December 20, 2021 19:57
@tswast tswast added the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 20, 2021
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Dec 20, 2021
Copy link

@plamut plamut left a comment

Choose a reason for hiding this comment

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

LGTM.

The two comments are non-blocking.
(making the annotation consistent with the docstring and excluding the TYPE_CHECKING imports from coverage)

Comment on lines 18 to 19
if typing.TYPE_CHECKING:
import pandas
Copy link

Choose a reason for hiding this comment

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

This will never be executed during the tests (TYPE_CHECKING is False at runtime), thus at some point coverage will complain. Let's add a # pragma: NO COVER comment to ignore this block.

@tswast tswast added the automerge Merge the pull request once unit tests and other checks pass. label Dec 22, 2021
@tswast
Copy link
Collaborator Author

tswast commented Dec 22, 2021

Thanks for the review @plamut!

@gcf-merge-on-green gcf-merge-on-green bot merged commit bf0e863 into googleapis:main Dec 22, 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 Dec 22, 2021
@tswast tswast deleted the issue266-read_gbq-no-query branch December 22, 2021 19:30
gcf-merge-on-green bot pushed a commit that referenced this pull request Jan 19, 2022
🤖 I have created a release *beep* *boop*
---


## [0.17.0](v0.16.0...v0.17.0) (2022-01-19)


### ⚠ BREAKING CHANGES

* use nullable Int64 and boolean dtypes if available (#445)

### Features

* accepts a table ID, which downloads the table without a query ([#443](#443)) ([bf0e863](bf0e863))
* use nullable Int64 and boolean dtypes if available ([#445](#445)) ([89078f8](89078f8))


### Bug Fixes

* `read_gbq` supports extreme DATETIME values such as `0001-01-01 00:00:00` ([#444](#444)) ([d120f8f](d120f8f))
* `to_gbq` allows strings for DATE and floats for NUMERIC with `api_method="load_parquet"` ([#423](#423)) ([2180836](2180836))
* allow extreme DATE values such as `datetime.date(1, 1, 1)` in `load_gbq` ([#442](#442)) ([e13abaf](e13abaf))
* avoid iteritems deprecation in pandas prerelease ([#469](#469)) ([7379cdc](7379cdc))
* use data project for destination in `to_gbq` ([#455](#455)) ([891a00c](891a00c))


### Miscellaneous Chores

* release 0.17.0 ([#470](#470)) ([29ac8c3](29ac8c3))

---
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-pandas API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Read BigQuery query table without a query
2 participants