scylladb / python-driver

ScyllaDB Python Driver, originally DataStax Python Driver for Apache Cassandra
https://python-driver.docs.scylladb.com
Apache License 2.0
74 stars 42 forks source link

CQLEngine stores naive timezone information - without an established default timezone #163

Open k0machi opened 2 years ago

k0machi commented 2 years ago

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)
fruch commented 11 months ago

@k0machi can you report this one upstream ?

Lorak-mmk commented 4 months ago

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