I have the following declarative Sqlalchemy schema:
class Locations(Base):
__tablename__ = 'locations'
group = Column(Integer, primary_key=True)
id = Column(String, primary_key=True)
shelf = Column(Integer, primary_key=True)
start = Column(Integer, nullable=False)
end = Column(Integer, nullable=False)
I would like to create the following index:
CREATE INDEX ixloc ON locations (shelf, "end" DESC) storing (start);
How could I add that?
Storing is an extension to CockroachDB's CREATE INDEX, which stores the given column in the index for faster retrieval.
I've already tried this without success:
Index.argument_for("cockroachdb", "storing", None)
Index('ixloc', Locations.shelf, Locations.end.desc(), cockroachdb_storing='start')