Skip to content

float value cannot be used to insert data to NUMERIC field. #315

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

Closed
vi3k6i5 opened this issue Apr 22, 2021 · 1 comment · Fixed by #316 or #317
Closed

float value cannot be used to insert data to NUMERIC field. #315

vi3k6i5 opened this issue Apr 22, 2021 · 1 comment · Fixed by #316 or #317
Assignees
Labels
api: spanner Issues related to the googleapis/python-spanner API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@vi3k6i5
Copy link
Contributor

vi3k6i5 commented Apr 22, 2021

Float data type is mapped to float: spanner.param_types.FLOAT64 Link.

We need to add support to map decimal.Decimal type in python to Numeric type in spanner.

Environment details

  • OS type and version: MacOS Big Sur 11.2.3
  • Python version: 3.8.8
  • pip version: pip 21.0.1
  • google-cloud-spanner version: 3.2.0

Steps to reproduce

  1. Create a table with Numeric field.
  2. Insert data in field with type float

Code example

sql='INSERT INTO t (x) VALUES (%s)', 
params=[3.194387483193242e+19]

Thanks!

@vi3k6i5
Copy link
Contributor Author

vi3k6i5 commented Apr 24, 2021

Decimal field is currently converted to string, need to remove that conversion.

@vi3k6i5 vi3k6i5 reopened this Apr 24, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Apr 25, 2021
@larkee larkee added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
3 participants