Description
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you've tried the usual "quick fixes":
- Search the issues already opened: https://github.com/googleapis/python-bigquery/issues
- Search StackOverflow: https://stackoverflow.com/questions/tagged/google-cloud-platform+python
If you are still having issues, please be sure to include as much information as possible:
Environment details
- OS type and version:
- Python version:
python --version
: Python 3.13.2 - pip version:
pip --version
: pip 25.0 google-cloud-bigquery
version:pip show google-cloud-bigquery
: 3.30.0
Steps to reproduce
>>> from google.cloud import bigquery
>>> bigquery.Client().query("SELECT * FROM (SELECT 1 as integer_field) WHERE 1 = 0").result().to_dataframe().dtypes
integer_field object
dtype: object
>>> bigquery.Client().query("SELECT * FROM (SELECT 1 as integer_field) WHERE 1 = 1").result().to_dataframe().dtypes
integer_field Int64
dtype: object
It uses subquery SELECT 1 as integer_field
to skip table setup, but it's same on normal query from tables.
cause
https://github.com/googleapis/python-bigquery/blob/v3.30.0/google/cloud/bigquery/table.py#L2642