Python Forum

Full Version: SQLAlchemy, TypeDecorator and alias
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I'm fighting with a very complex software. In one place there is a TypeDecorator for datetime.datetime, which is always returns datetime (i.e. transform selected datetime) with tzinfo UTC. It works as expected.
But in one module, someone used aliases and as a result datetime is always returned without tzinfo.

https://kite.com/python/docs/sqlalchemy....il.aliased - it is said here that "returned Alias is not ORM-mapped in this case"

Is it possible to modify one column in alias table so it will be decorated datetime object? Or the only way is to iterate over result to find datetime and make it timezone aware?