I would like to set the maximum limit for the index in the Column definition or only through the Index constructor, but it seems I have not found a way to achieve it.
Basically, I would like to model this MySQL behavior:
CREATE TABLE some_table ( id int(11) NOT NULL AUTO_INCREMENT, some_text varchar(2048) DEFAULT NULL, PRIMARY KEY (id), KEY some_text (some_text(1024)),
In SQLAlchemy, I will have something like:
class SomeTable(BaseModel): __tablename__ = 'some_table' __seqname__ = 'some_table_id_seq' id = sa.Column(sa.Integer(11), sa.Sequence(__seqname__), primary_key=True) some_text = sa.Column(sa.String(2048), index=True)
but I canβt find anything that would suggest that the index limit can be configured. Sort of:
some_text = sa.Column(sa.String(2048), index=True, index_length=1024)
I assume that since this parameter for the Column constructor is just an alias for the Index constructor, is there a custom parameter to include in the Index constructor to enable this setting?
Thanks!
source share