python-driver icon indicating copy to clipboard operation
python-driver copied to clipboard

CQLEngine stores naive timezone information - without an established default timezone

Open k0machi opened this issue 3 years ago • 2 comments

Using a datetime column the timezone information is lost and timestamp is sent off as is, where it is seemingly interpreted as UTC-0 timezone, leading to a confusion. I'm suggesting to instead convert said timestamp into UTC one if its timezone differs before submitting.

from uuid import uuid4
from datetime import datetime
from cassandra.cqlengine import models
from cassandra.cqlengine import columns

class Example(models.Model):
    pk = columns.UUID(primary_key=True, default=uuid4)
    indexed_list = columns.DateTime(default=datetime.now)

k0machi avatar Aug 17 '22 15:08 k0machi

@k0machi can you report this one upstream ?

fruch avatar Nov 13 '23 14:11 fruch

@k0machi Is there an upstream issue opened? If so, I'd like to close this one.

Lorak-mmk avatar Jun 18 '24 16:06 Lorak-mmk