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 — django: integer division produces a float result, which can't be assigned to an integer column · Issue #331 · googleapis/python-spanner-django

This repository was archived by the owner on Jun 8, 2026. It is now read-only.
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

django: integer division produces a float result, which can't be assigned to an integer column #331

Copy link
Copy link
Closed
Closed
django: integer division produces a float result, which can't be assigned to an integer column#331
Copy link
Labels
api: spannerIssues related to the googleapis/python-spanner-django API.blockedIssues that cannot be implemented because of some limitpriority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.we-cannot-typecheck-spanner-columnswontfixThis will not be worked on

Description

@timgraham
timgraham
opened on Mar 14, 2020
Issue body actions

e.g. Number.objects.filter(pk=self.n.pk).update(integer=F('integer') / 2, float=F('float') / 42.7)

Traceback:

======================================================================
ERROR: test_lefthand_division (expressions.tests.ExpressionOperatorTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 57, in error_remapped_callable
    return callable_(*args, **kwargs)
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/grpc/_channel.py", line 690, in __call__
    return _end_unary_response_blocking(state, call, False, None)
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/grpc/_channel.py", line 592, in _end_unary_response_blocking
    raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
	status = StatusCode.INVALID_ARGUMENT
	details = "Value of type FLOAT64 cannot be assigned to the_integer, which has type INT64 [at 1:46]\nUPDATE expressions_number SET the_integer = (expressions_number.the_integer /...\n                                             ^"
	debug_error_string = "{"created":"@1584199314.903533434","description":"Error received from peer ipv4:172.217.6.202:443","file":"src/core/lib/surface/call.cc","file_line":1055,"grpc_message":"Value of type FLOAT64 cannot be assigned to the_integer, which has type INT64 [at 1:46]\nUPDATE expressions_number SET the_integer = (expressions_number.the_integer /...\n                                             ^","grpc_status":3}"
>

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/tim/code/spanner-django/spanner/dbapi/autocommit_on_cursor.py", line 95, in execute
    self.__handle_update(sql, args or None)
  File "/home/tim/code/spanner-django/spanner/dbapi/autocommit_on_cursor.py", line 106, in __handle_update
    sql, params,
  File "/home/tim/code/spanner-django/spanner/dbapi/autocommit_on_connection.py", line 74, in in_transaction
    return self.__dbhandle.run_in_transaction(fn, *args, **kwargs)
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/google/cloud/spanner_v1/database.py", line 443, in run_in_transaction
    return session.run_in_transaction(func, *args, **kw)
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/google/cloud/spanner_v1/session.py", line 299, in run_in_transaction
    return_value = func(txn, *args, **kw)
  File "/home/tim/code/spanner-django/spanner/dbapi/autocommit_on_cursor.py", line 113, in __do_execute_update
    res = transaction.execute_update(sql, params=params, param_types=get_param_types(params))
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/google/cloud/spanner_v1/transaction.py", line 202, in execute_update
    metadata=metadata,
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/google/cloud/spanner_v1/gapic/spanner_client.py", line 812, in execute_sql
    request, retry=retry, timeout=timeout, metadata=metadata
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/google/api_core/gapic_v1/method.py", line 143, in __call__
    return wrapped_func(*args, **kwargs)
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/google/api_core/retry.py", line 277, in retry_wrapped_func
    on_error=on_error,
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/google/api_core/retry.py", line 182, in retry_target
    return target()
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/google/api_core/timeout.py", line 214, in func_with_timeout
    return func(*args, **kwargs)
  File "/home/tim/.virtualenvs/django37/lib/python3.7/site-packages/google/api_core/grpc_helpers.py", line 59, in error_remapped_callable
    six.raise_from(exceptions.from_grpc_error(exc), exc)
  File "<string>", line 3, in raise_from
google.api_core.exceptions.InvalidArgument: 400 Value of type FLOAT64 cannot be assigned to the_integer, which has type INT64 [at 1:46]\nUPDATE expressions_number SET the_integer = (expressions_number.the_integer /...\n                                             ^

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tim/code/django/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tim/code/spanner-django/spanner/dbapi/autocommit_on_cursor.py", line 99, in execute
    raise ProgrammingError(e.details if hasattr(e, 'details') else e)
spanner.dbapi.exceptions.ProgrammingError: 400 Value of type FLOAT64 cannot be assigned to the_integer, which has type INT64 [at 1:46]\nUPDATE expressions_number SET the_integer = (expressions_number.the_integer /...\n                                             ^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/tim/code/django/tests/expressions/tests.py", line 973, in test_lefthand_division
    Number.objects.filter(pk=self.n.pk).update(integer=F('integer') / 2, float=F('float') / 42.7)
  File "/home/tim/code/django/django/db/models/query.py", line 741, in update
    rows = query.get_compiler(self.db).execute_sql(CURSOR)
  File "/home/tim/code/django/django/db/models/sql/compiler.py", line 1469, in execute_sql
    cursor = super().execute_sql(result_type)
  File "/home/tim/code/django/django/db/models/sql/compiler.py", line 1140, in execute_sql
    cursor.execute(sql, params)
  File "/home/tim/code/django/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/home/tim/code/django/django/db/backends/utils.py", line 76, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/home/tim/code/django/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tim/code/django/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/home/tim/code/django/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/home/tim/code/spanner-django/spanner/dbapi/autocommit_on_cursor.py", line 99, in execute
    raise ProgrammingError(e.details if hasattr(e, 'details') else e)
django.db.utils.ProgrammingError: 400 Value of type FLOAT64 cannot be assigned to the_integer, which has type INT64 [at 1:46]\nUPDATE expressions_number SET the_integer = (expressions_number.the_integer /...\n                                             ^

Activity

  1. timgraham
    added
    bug
    on Mar 14, 2020
  2. timgraham
    added 4 commits that reference this issue on Mar 18, 2020

    django: fixed power operator (^)

    4e4f2ef

    django: fix power operator (^)

    d940e47

    django: fix power operator

    8f47d80

    django: fix power operator

    51c56e3
  3. odeke-em
    added
    blockedIssues that cannot be implemented because of some limit
    we-cannot-typecheck-spanner-columns
    on Mar 20, 2020
  4. gcf-label-sync
    removed
    bug
    on Mar 31, 2020
  5. yoshi-automation
    added
    triage meI really want to be triaged.
    🚨This issue needs some love.
    on Apr 7, 2020
  6. JustinBeckwith
    added
    api: spannerIssues related to the googleapis/python-spanner-django API.
    on Apr 8, 2020
  7. odeke-em
    added
    wontfixThis will not be worked on
    and removed
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Apr 16, 2020
  8. yoshi-automation
    added
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Apr 16, 2020
  9. odeke-em
    added
    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.
    and removed
    triage meI really want to be triaged.
    🚨This issue needs some love.
    on Apr 16, 2020
  10. yoshi-automation
    added
    🚨This issue needs some love.
    triage meI really want to be triaged.
    and removed
    🚨This issue needs some love.
    triage meI really want to be triaged.
    on Apr 16, 2020
  11. timgraham
    added a commit that references this issue on Apr 22, 2020

    document 'Computations that yield FLOAT64 values can't be assigned to…

    c7f5add
  12. timgraham commented on Apr 22, 2020

    @timgraham
    timgraham
    on Apr 22, 2020
    ContributorAuthor
    More actions

    I'll document this limitation. Should we leave the issue open after that? Is it possible that Spanner would remove this restriction in a future release?

  13. timgraham
    added 3 commits that reference this issue on Apr 24, 2020

    document 'Computations that yield FLOAT64 values can't be assigned to…

    556ab98

    document 'Computations that yield FLOAT64 values can't be assigned to…

    83953be

    document 'Computations that yield FLOAT64 values can't be assigned to…

    b3c65d5
  14. asthamohta commented on May 19, 2022

    @asthamohta
    asthamohta
    on May 19, 2022
    Contributor
    More actions

    Adding support to this would have serious performance impacts of this. In addition, real Spanner supports non-typed parameters, and the missing support for non-typed parameters for some type (DATE and TIMESTAMP) in the emulator is considered a bug: GoogleCloudPlatform/cloud-spanner-emulator#31
    Further details about the decisions can be checked here: googleapis/python-spanner#200

  15. asthamohta
    closed this as completedon May 19, 2022
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: spannerIssues related to the googleapis/python-spanner-django API.blockedIssues that cannot be implemented because of some limitpriority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.we-cannot-typecheck-spanner-columnswontfixThis will not be worked on

    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.