Skip to content

to_dataframe always shows warning if max_results is set #806

@tswast

Description

@tswast

to_dataframe always shows a warning that bqstorage_client is set if max_results is set. This warning should not be shown if bqstorage_client is not explicitly set.

Code example

df = bigquery_client.list_rows(
        scalars_table,
        max_results=10,
)

Stack trace

$ pytest tests/system/test_pandas.py::test_list_rows_nullable_scalars_dtypes
========================================= test session starts =========================================
platform darwin -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/swast/src/python-bigquery
plugins: cov-2.12.1, asyncio-0.15.1
collected 2 items                                                                                     

tests/system/test_pandas.py ..                                                                  [100%]

========================================== warnings summary ===========================================
tests/system/test_pandas.py::test_list_rows_nullable_scalars_dtypes[10]
  /Users/swast/src/python-bigquery/google/cloud/bigquery/table.py:1899: UserWarning: Cannot use bqstorage_client if max_results is set, reverting to fetching data with the REST endpoint.
    if not self._validate_bqstorage(bqstorage_client, create_bqstorage_client):

-- Docs: https://docs.pytest.org/en/stable/warnings.html
==================================== 2 passed, 1 warning in 11.95s ====================================

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions