Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bigquery.ArrayQueryParameter should be able to accept structs as elements of the array #2906

Closed
tswast opened this issue Dec 28, 2016 · 0 comments
Assignees
Labels
api: bigquery Issues related to the BigQuery API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@tswast
Copy link
Contributor

tswast commented Dec 28, 2016

I commented that setting the types on array query parameters needs to be recursive since the array could contain structs. Note that arrays cannot contain arrays (the workaround is to contain a struct which can then contain an array).

It's not clear how one would do this with the current ArrayQueryParameter constructor.

bigquery.ArrayQueryParameter(
    name='myarray', 
    type='STRUCT',  # Note: this isn't enough information to construct the type object.
    values=?  # What would go here? Dictionaries? That doesn't match other uses of StructQueryParameter.
)

Maybe we need to change how array query parameters are constructed? Maybe it should look more like the StructQueryParameter constructor?

bigquery.ArrayQueryParameter(name, *sub_params)

It'd be a pain for scalar values and the names would have to be ignored on the sub_params if provided, but it's more flexible.

An aside

I'd actually love if we could get rid of all the XQueryParameter classes and use lists, dicts, and ints, floats, etc. But I see that it might be ambiguous for some types especially DATETIME (no time zone) vs TIMESTAMP (stored as UTC time).

@tswast tswast added api: bigquery Issues related to the BigQuery API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Dec 28, 2016
@danoscarmike danoscarmike added the priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. label Feb 28, 2017
richkadel pushed a commit to richkadel/google-cloud-python that referenced this issue May 6, 2017
Add a system test to verify the feature.

Closes googleapis#2906.

Toward googleapis#3029.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

4 participants