Skip to content

BigQuery: ArrayQueryParameter.from_api_repr fails with STRUCT query parameter values #4023

@tswast

Description

@tswast

I encountered a system test error on the bigquery-b2 work when I modified some system tests to use QueryJob to pass in query parameters. The job resource that comes back cannot be parsed because of the query parameters in the query statistics.

The resource which is show the problem is this one:

    RESOURCE = {
        'parameterType': {
            'type': 'ARRAY',
            'arrayType': {
                'type': 'STRUCT',
                'structTypes': [
                    {
                        'name': 'name',
                        'type': {'type': 'STRING'}},
                    ,
                    {
                        'name': 'age',
                        'type': {'type': 'INT64'},
                    },
                ],
            },
        },
        'parameterValue': {
            'arrayValues': [
                {
                    'structValues': {
                        'name': {'value': 'Phred Phlyntstone'},
                        'age': {'value': '32'},
                    },
                },
                {
                    'structValues': {
                        'name': {
                            'value': 'Bharney Rhubbyl',
                        },
                        'age': {'value': '31'},
                    },
                },
            ],
        },
    }

I'm currently investigating a fix. Will make a PR to master rather than bigquery-b2 when ready because this issue will affect that branch too and I want a fix out possibly before Beta 2 is ready.

Metadata

Metadata

Assignees

Labels

api: bigqueryIssues related to the BigQuery API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions