is this psycopg2 ?  If you use Python datetime objects with the tz attribute 
set, it should just work, psycopg2 should do that conversion for you (haven't 
checked, but typically they are pretty good in this area).

Otherwise there are some SQLAlchemy routes to this, including the @compiles 
extension as well as the ability to associate SQL expressions with types.

If it were me, I'd advise just running your dates through a TZ conversion 
function on the Python side first so that they are in the TZ expected by the 
database beforehand.   A custom type can also do this.



On Nov 19, 2012, at 1:03 AM, espresso maker wrote:

> Hi,
> 
> I have a table 'my_log' with a created_at column of type timestamp with time 
> zone;
> 
> class Log(Base):
>     __tablename__ = "my_log"
>       ....
>       created_at = Column(DateTime(timezone=True), nullable=False,
>                         server_default=func.now())
> 
> 
> I would like to query Log and have created_at append: at time zone 
> '<timezone>'  without going through many hoops.
> 
> 
> Any thoughts of implementing it cleanly?
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/sqlalchemy/-/245CZe0qjvYJ.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to