On 13Mar2023 09:05, Yoav Kopfstein <[email protected]> wrote:
I would like to declare an index in orm class with sqlalchemy 1.4
The index is created in postgres with this command:

create index index_name
   on table_name (GREATEST(field_1, field_2));

how can I do it?     (with __table_args__ or without )

Do you have the rest of your table definiton to hand for comparison?

Have you see this example in the core docs:
https://docs.sqlalchemy.org/en/14/core/constraints.html#indexes

Cheers,
Cameron Simpson <[email protected]>

--
SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/ZA%2BGtuidHpusT%2BRD%40cskk.homeip.net.

Reply via email to