Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

object dtype when empty query result #2148

Closed

Description

@yokomotod

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":

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

Activity

  1. added
    api: bigquery
    on Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigquery

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions