Greetings,

I'm trying to use PostgreSQL's TIME WITH TIME ZONE type. I've used 
SQLAlchemy's generic type Time(timezone=True) and it was successful that 
the schema was reflected to TIME WITH TIME ZONE(timetz) when I use alembic 
or metadata.create_all(). 

The problem is, it seems that the timezone-aware datetime.time objects are 
considered as timezone-naive time type(casted to time, not timetz). For 
example::

>>> # 21:00+00 (UTC)
>>> repr(t)
'datetime.time(21, 0, tzinfo=<styleshare.utc.UTC object at 0x10f5f7b10>)'

>>> # 21:00+09 (KST) == 12:00+00 (UTC)
>>> query(m.Advertisement.live_time).all()
[(datetime.time(21, 0, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=540, 
name=None)),)]

>>> # Should be 0 rows, but..
>>> query(m.Advertisement.live_time).filter_by(live_time=t).all()
[(datetime.time(21, 0, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=540, 
name=None)),)]

>>> # Executed SQL
>>> print query(m.Advertisement.live_time).filter_by(live_time=t).render()
SELECT advertisements.live_time
FROM advertisements
WHERE advertisements.live_time = *'21:00:00+00:00'::time*

Example Environment::
  - SQLAlchemy 0.9.4
  - PostgreSQL 9.3.4.2
  - m.Advertisement.live_time property is OR-mapped on 
advertisements.live_time column in the database and it's defined as TIME 
WITH TIME ZONE.

Is it the bug of SQLAlchemy or were there any mistakes? Any helps are 
welcome.

Thank you,
Hyunjun

-- 
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