Julien Cigar
2009-08-13 09:27:18 UTC
Hello,
I'm using PostgreSQL / SQLAlchemy 0.5.5 and I build my Table objects
using the reflection feature :
{{{
metadata = schema.MetaData()
metadata.reflect(bind=_engine)
}}}
I have a table which has a timestamptz column and when I try to insert a
(for example) datetime(2009, 13, 12, 10, 12) in it, it fails with the
following exception :
<type 'exceptions.TypeError'>: can't compare offset-naive and
offset-aware datetimes
I guess it's because one side has a tzinfo and the other not. When I
look at the documentation the constructor of sqlalchemy.types.DateTime
has a "timezone" parameter which is False by default. However when I
look at the column, timezone is set to True:
Column(u'effective', PGDateTime(timezone=True), table=<content>)
which is correct.
Any idea how could I resolve this annoying problem ? Is it possible to
set a default timezone in SQLAlchemy, or do I need to derive a concrete
subclass of datetime.tzinfo, and pass it to every datetime() object ?
Thanks,
Julien
--
Julien Cigar
Belgian Biodiversity Platform
http://www.biodiversity.be
Université Libre de Bruxelles (ULB)
Campus de la Plaine CP 257
Bâtiment NO, Bureau 4 N4 115C (Niveau 4)
Boulevard du Triomphe, entrée ULB 2
B-1050 Bruxelles
Mail: ***@ulb.ac.be
@biobel: http://biobel.biodiversity.be/person/show/471
Tel : 02 650 57 52
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to sqlalchemy+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---
I'm using PostgreSQL / SQLAlchemy 0.5.5 and I build my Table objects
using the reflection feature :
{{{
metadata = schema.MetaData()
metadata.reflect(bind=_engine)
}}}
I have a table which has a timestamptz column and when I try to insert a
(for example) datetime(2009, 13, 12, 10, 12) in it, it fails with the
following exception :
<type 'exceptions.TypeError'>: can't compare offset-naive and
offset-aware datetimes
I guess it's because one side has a tzinfo and the other not. When I
look at the documentation the constructor of sqlalchemy.types.DateTime
has a "timezone" parameter which is False by default. However when I
look at the column, timezone is set to True:
Column(u'effective', PGDateTime(timezone=True), table=<content>)
which is correct.
Any idea how could I resolve this annoying problem ? Is it possible to
set a default timezone in SQLAlchemy, or do I need to derive a concrete
subclass of datetime.tzinfo, and pass it to every datetime() object ?
Thanks,
Julien
--
Julien Cigar
Belgian Biodiversity Platform
http://www.biodiversity.be
Université Libre de Bruxelles (ULB)
Campus de la Plaine CP 257
Bâtiment NO, Bureau 4 N4 115C (Niveau 4)
Boulevard du Triomphe, entrée ULB 2
B-1050 Bruxelles
Mail: ***@ulb.ac.be
@biobel: http://biobel.biodiversity.be/person/show/471
Tel : 02 650 57 52
No trees were killed in the creation of this message.
However, many electrons were terribly inconvenienced.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To post to this group, send email to ***@googlegroups.com
To unsubscribe from this group, send email to sqlalchemy+***@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---