Unable to insert timeuuid from datetime

Description

Hi,

I'm trying to save a model instance with a timeuuid as primary_key and with a default value using cassandra.util method : uuid_from_time (since from_datetime is deprecated).

time = columns.TimeUUID(primary_key=True, default=util.uuid_from_time(datetime.datetime.now()))

But when I save my instance, I get an InvalidRequest error saying that cassandra is unable to make unsigned int (for date) from a given timestamp. Is this a compatibility issue and do I need to downgrade ?

Windows 10 64b (sry)
Python 3.5.1
Cassandra 3.7

cassandra-driver (3.5.0)
cql (1.4.0)
cqlsh (5.0.3)

If anyone know what am I doing wrong, thank you in advance.

NB : I'm using django (without django-cassandra-engine for now)

Here is the full trace :

Traceback (most recent call last):
File "virtualenv_dir\lib\site-packages\django\core\handlers\base.py", line 149, in get_response
response = self.process_exception_by_middleware(e, request)
File "virtualenv_dir\lib\site-packages\django\core\handlers\base.py", line 147, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "virtualenv_dir\lib\site-packages\django\views\decorators\csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "working_dir\views.py", line 52, in register
response = saveUserData(received_json_data)
File "working_dir\views.py", line 87, in saveUserData
newUserData.save()
File "virtualenv_dir\lib\site-packages\cassandra\cqlengine\models.py", line 690, in save
if_exists=self._if_exists).save()
File "virtualenv_dir\lib\site-packages\cassandra\cqlengine\query.py", line 1328, in save
self._execute(insert)
File "virtualenv_dir\lib\site-packages\cassandra\cqlengine\query.py", line 1216, in _execute
results = _execute_statement(self.model, statement, self._consistency, self._timeout)
File "virtualenv_dir\lib\site-packages\cassandra\cqlengine\query.py", line 1356, in _execute_statement
return connection.execute(s, params, timeout=timeout)
File "virtualenv_dir\lib\site-packages\cassandra\cqlengine\connection.py", line 170, in execute
result = session.execute(query, params, timeout=timeout)
File "cassandra\cluster.py", line 1710, in cassandra.cluster.Session.execute (cassandra/cluster.c:28539)
File "cassandra\cluster.py", line 3343, in cassandra.cluster.ResponseFuture.result (cassandra/cluster.c:62985)
cassandra.InvalidRequest: Error from server: code=2200 [Invalid query] message="Unable to make unsigned int (for date) from: '1469468467847'"

Environment

None

Pull Requests

None

Activity

Show:
Alan Boudreault
July 26, 2016, 3:40 AM

, Hello! I tried to reproduce this issue without success. 3.5.0 is currently the latest release. I am wondering if this is not a django_cassandra-engine issue (that we are not the maintainer). Can you you try the following test case and see if you can reproduce the bug using cqlengine alone:

abelga
July 26, 2016, 4:38 AM
Edited

@aboudreault, Bonjour (j'ai jeté un œil à ton profil linkedin, ne m'en veux pas ),
Merci beaucoup pour ton aide, il semblerait que Django ne puisse pas synchroniser les modèles après leur déclaration (models.py généré par django) et que je doive le faire à l'importation (dans mon fichier views.py juste après la connexion).
Vraiment désolé pour cette erreur et merci encore pour ta rapidité.

Keep doing great work

Alan Boudreault
July 26, 2016, 4:54 AM

Ca fait plaisir . Bonne continuation!


To summarize, this issue is related to django + django_cassandra-engine. Closing the ticket.

Not a Problem

Assignee

Unassigned

Reporter

abelga

Fix versions

None

Reproduced in

None

PM Priority

None

External issue ID

None

Doc Impact

None

Reviewer

None

Size

None

Pull Request

None

Affects versions

Priority

Major