Python Forum
SQLAlchemy, TypeDecorator and alias
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SQLAlchemy, TypeDecorator and alias
#1
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?
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020