object dtype when empty query result · Issue #2148 · googleapis/python-bigquery · GitHub | Latest TMZ Celebrity News & Gossip | Watch TMZ Live
Skip to content

object dtype when empty query result #2148

Closed
@yokomotod

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigqueryIssues related to the googleapis/python-bigquery API.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      TMZ Celebrity News – Breaking Stories, Videos & Gossip

      Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.

      Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.

      🎥 Watch TMZ Live

      TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.