Mike,

traditionally, you are right ;)
Problem was caused by one row with invalid timestamp.
It looks something weird because it is Postgres but the problem is not in 
SQLAlchemy in such case.

Thank you for these helpful details :)

Regards,
Artur

W dniu poniedziałek, 7 kwietnia 2014 16:41:39 UTC+2 użytkownik Michael 
Bayer napisał:
>
>
> On Apr 7, 2014, at 4:07 AM, artee <artu...@gmail.com <javascript:>> wrote:
>
> Hi
>
> SQLAlchemy==0.9.3 and Versioned mixin pattern are used.
>
> I've encountered a problem when timezones are used in date & time fields 
> e.g.: DateTime(timezone=True).
> In Versioned mixin, create_version functions fails at 
> attributes.get_history function with the exception as follows:
> can't compare offset-naive and offset-aware datetimes.
> Is there any other place in SA to set when timezone aware comparison 
> should be done to get historical data or this is a bug?
>
>
> Unless you’re using the SQLite dialect, for which SQLAlchemy converts 
> between date times and strings and does not support the “timezone” flag, 
> SQLAlchemy has no interaction with the date time values that are passed 
> between backends, including all the backends like Postgresql, Mysql, SQL 
> Server etc.     So whatever you put in there is what you’ll get out.  If 
> you load a datetime value which is offset aware, and you compare it with an 
> offset naive, you’ll get that error and that’s on your end to fix (the fix 
> being, make sure you only send offset-aware datetimes towards that column, 
> or apply validators or TypeDecorators to ensure this).
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to