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

feat: add DECIMAL and BIGDECIMAL as aliases for NUMERIC and BIGNUMERIC to scalar types enums #633

Closed
tswast opened this issue Apr 28, 2021 · 10 comments
Assignees
Labels
api: bigquery Issues related to the googleapis/python-bigquery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@tswast
Copy link
Contributor

tswast commented Apr 28, 2021

#626 (comment)

@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/python-bigquery API. label Apr 28, 2021
@tswast tswast self-assigned this Apr 28, 2021
@tswast
Copy link
Contributor Author

tswast commented Apr 28, 2021

On second-thought, these are actually called NUMERIC and BIGNUMERIC in BigQuery. I don't know if we want to be adding aliases outside of those we already have for Legacy SQL support.

🤔

@tswast tswast changed the title feat: add DECIMAL and BIGDECIMAL to scalar types enums feat: add DECIMAL and BIGDECIMAL as aliases for NUMERIC and BIGNUMERIC to scalar types enums Apr 28, 2021
@tswast tswast removed their assignment Apr 28, 2021
@tswast tswast added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Apr 28, 2021
@jimfulton
Copy link
Contributor

But these are defined as valid standard sql aliases here: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#decimal_types

@jimfulton
Copy link
Contributor

IMO, this is a bug not a feature. :)

@jimfulton
Copy link
Contributor

@tswast shall I address this?

@tswast
Copy link
Contributor Author

tswast commented Apr 28, 2021

Gotcha. I didn't realize the backend had these as aliases. Yes, let's go for it.

@jimfulton
Copy link
Contributor

jimfulton commented Apr 28, 2021

I can't find any use of SqlParameterScalarTypes.

I searched:

  • the google and test source directories.
  • the internet using google. :)

Is there a reason we think we need this (other than for our internal use)?

@tswast
Copy link
Contributor Author

tswast commented Apr 30, 2021

I'd like to use those in code samples where folks have STRUCT type query parameters with sub-fields

Honestly, it'd be much more useful if we supplemented the class to allow a builder-style construction where we add a with_name(...) function that makes a copy of the parameter type but adds a name.

@tswast
Copy link
Contributor Author

tswast commented Apr 30, 2021

Closed by #638

@tswast tswast closed this as completed Apr 30, 2021
@jimfulton
Copy link
Contributor

I'd like to use those in code samples where folks have STRUCT type query parameters with sub-fields

I'm thinking that there's a lot to unpack there. :)

  • "those" meaning decimal types? Or the enums?
  • "code samples" do you mean code in the samples/ directory? (I haven't ventured there yet.)
  • "STRUCT type query parameters with sub-fields" My head just exploded a little. :) I guess this is going to be something like:
    "select %(foo:STRUCT<INT64,STRING>)s"

Honestly, it'd be much more useful if we supplemented the class to allow a builder-style construction where we add a with_name(...) function that makes a copy of the parameter type but adds a name.

I'm lost. which class?

Can you expand a little?

@tswast
Copy link
Contributor Author

tswast commented Apr 30, 2021

"those"

I mean the ScalarQueryParameter type. I've filed #642 we can continue the discussion of the feature there.

"code samples"

Yes, I mean the samples/ directory. Usually we aim to publish those samples on cloud.google.com/bigquery/docs as well.

"STRUCT type query parameters with sub-fields" My head just exploded a little. :) I guess this is going to be something like: "select %(foo:STRUCT<INT64,STRING>)s"

That's right! See: #463

In addition to what you've written with anonymous sub-fields, it's also possible to give those names.

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 googleapis/python-bigquery API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants