hyperboreean
hyperboreean

Reputation: 8343

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 SQLAlchemy in the ORM framework?

Upvotes: 2

Views: 938

Answers (1)

Denis Otkidach
Denis Otkidach

Reputation: 33250

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

Upvotes: 3

Related Questions