Skip to content

BUG: read_gbq return timestamp as long int #667

@itay-jether

Description

@itay-jether

Hey, I've tried to read parquet files using gbq, and it returns an integer instead of timestamps. example attached below
it works for me on python 3.10, same pandas and pandas_gbq version

Environment details

  • OS type and version: ubuntu 4.22
  • Python version: python 3.11.4
  • pip version: 22.3.1
  • pandas-gbq version: 0.19.2

Steps to reproduce

  1. install python 3.11

Code example

import pandas as pd


s = pd.Series(0, index=pd.date_range('2021-01-01 01', periods=24, freq='H', tz='UTC', name='ts')).to_frame().reset_index()
save_path = 'gs://my_bucket/test_dir'
s.to_parquet(f'{save_path}/test_gbq.parquet', index=False)
s_res = pd.read_gbq('select * from test_data', 
            configuration={'query': {
                'tableDefinitions': 
                    {'test_data': {'sourceFormat': 'PARQUET',
                                   'sourceUris': [f'{save_path}/*.parquet'],
                                   'autodetect': True}}}},
            location='eu'
)
print(s)
#                          ts  0
# 0 2021-01-01 01:00:00+00:00  0
# 1 2021-01-01 02:00:00+00:00  0
# 2 2021-01-01 03:00:00+00:00  0
# 3 2021-01-01 04:00:00+00:00  0
# 4 2021-01-01 05:00:00+00:00  0
print(s_res)
#                     ts  0
# 0  1609462800000000000  0
# 1  1609466400000000000  0
# 2  1609470000000000000  0
# 3  1609473600000000000  0
# 4  1609477200000000000  0

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: bigqueryIssues related to the googleapis/python-bigquery-pandas API.priority: p3Desirable enhancement or fix. May not be included in next release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions