GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — load_table_toDataframe breaks with Arrow list fields when the list is backed by a ChunkedArray. · Issue #1808 · googleapis/python-bigquery

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.

load_table_toDataframe breaks with Arrow list fields when the list is backed by a ChunkedArray. #1808

Copy link
Copy link
Closed
Closed
load_table_toDataframe breaks with Arrow list fields when the list is backed by a ChunkedArray.#1808
Copy link
Labels
api: bigqueryIssues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. Fix may not be included in next release.

Description

@cvm-a
cvm-a
opened on Feb 1, 2024
Issue body actions

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: MacOS Darwin Kernel Version 22.1.0
  • Python version: 3.11
  • pip version: 23.2.1
  • google-cloud-bigquery version: 3.15.0

Steps to reproduce

  1. Create an Arrow backed dataframe with a large list field.
  2. Create a google.cloud.bigquery Client
  3. call Client.load_table_from_dataframe on this dataframe

Code example

# example
import pandas as pd
import pyarrow as pa
from google.cloud import bigquery as gbq

client= gbq.Client(
            project=<project_id>,
            credentials=<credentials>,
            location=<location>,
        )
df = pd.DataFrame({"x":pa.array(pd.Series([[2.2]*5]*10000000)).to_pandas(types_mapper=pd.ArrowDtype)})
client.load_table_from_dataframe(
            df, 'temporary_tables.chunked_array_error')

Stack trace

  File "/Users/<redacted>", line 250, in create_table_from_dataframe
    load_job = self.client.load_table_from_dataframe(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/lib/python3.11/site-packages/google/cloud/bigquery/client.py", line 2671, in load_table_from_dataframe
    new_job_config.schema = _pandas_helpers.dataframe_to_bq_schema(
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>/lib/python3.11/site-packages/google/cloud/bigquery/_pandas_helpers.py", line 465, in dataframe_to_bq_schema
    bq_schema_out = augment_schema(dataframe, bq_schema_out)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/<redacted>lib/python3.11/site-packages/google/cloud/bigquery/_pandas_helpers.py", line 500, in augment_schema
    arrow_table.values.type.id
    ^^^^^^^^^^^^^^^^^^
AttributeError: 'pyarrow.lib.ChunkedArray' object has no attribute 'values'

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

Activity

  1. product-auto-label
    added
    api: bigqueryIssues related to the googleapis/python-bigquery API.
    on Feb 1, 2024
  2. cvm-a commented on Feb 1, 2024

    @cvm-a
    cvm-a
    on Feb 1, 2024
    Author
    More actions

    The easiest fix is to replace arrow_table.values.type.id with arrow_table.type.value_type.id.

  3. Linchin commented on Feb 2, 2024

    @Linchin
    Linchin
    on Feb 2, 2024
    Contributor
    More actions

    I'm unable to reproduce the issue with the code you provided - the BQ table was created successfully. I wonder which version of PyArrow and Pandas you are using? I'm using pyarrow==15.0.0, and pandas==2.2.0. My guess is we don't support converting ChunkedArray into BigQuery types, but your pandas/pyarrow decided to use it.

  4. Linchin
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Feb 2, 2024
  5. Linchin commented on Apr 8, 2024

    @Linchin
    Linchin
    on Apr 8, 2024
    Contributor
    More actions

    I will close this issue now. For future people who are interested in loading an Arrow ChunkedArray, please consider using Arrow's Table.from_arrays() to convert it into a table.

  6. Linchin
    closed this as completedon Apr 8, 2024
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: bigqueryIssues related to the googleapis/python-bigquery API.priority: p2Moderately-important priority. 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

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.