SQLAlchemy set index on coalesce
I am trying to set up an index for a table on the coalesce function, rather than on a column. I am using PostgreSQL and I am trying to achieve something like :
create index t on tbl using btree (coalesce(ts_updated, '2002-08-08'))
Anyone knows how can I achieve this with SQLAlch开发者_开发问答emy in the ORM framework?
SQLAlchemy doesn't support expression in index definitions yet, but it's a planned feature. Right now you have to use custom DDL (see examples in documentation).
精彩评论