SQLalchemy specify which index to use SQLalchemy specify which index to use sql sql

SQLalchemy specify which index to use


I think you can use with_hint() for this.

e.g.

session.query(Model).with_hint(Model, 'USE INDEX col1_index')

Honestly, I didn't really know about this; I discovered it by finding 'USE INDEX' in their ORM tests.