Skip to content
Advertisement

SQLAlchemy How to create a composite index between a polymorphic class and it’s subclass

I am trying to get a composite index working between a polymorphic subclass and it’s parent.

Alembic autogenerate does not seem to detect Indexes outside of __table_args__.

I can’t use __table_args__ because, being in the subclass, it does not count my class as having a __table__.

How do I create a composite Index between these?

JavaScript

The goal is to have something like this pop with alembic autogenerate:

JavaScript

Thank you for your time and potential future help.

EDIT: Note: The other fields are detected by autogenerate, only the index done this way does not seem to work.

Advertisement

Answer

Create the index externally after both classes:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement