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
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions pandas_gbq/gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@
import time
import warnings
from datetime import datetime
import typing
from typing import Dict, Optional, Union

import numpy as np

# Only import at module-level at type checking time to avoid circular
# dependencies in the pandas package, which has an optional dependency on
# pandas-gbq.
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.


# Required dependencies, but treat as optional so that _test_google_api_imports
# can provide a better error message.
try:
Expand Down Expand Up @@ -380,8 +388,14 @@ def process_http_error(ex):
raise GenericGBQException("Reason: {0}".format(ex))

def download_table(
self, table_id, max_results=None, progress_bar_type=None, dtypes=None
):
self,
table_id: str,
max_results: Optional[int] = None,
progress_bar_type: Optional[str] = None,
dtypes: Dict[
str, Union[str, "pandas.api.extensions.ExtensionDtype", np.dtype]
] = None,
) -> "pandas.DataFrame":
self._start_timer()

try:
Expand Down