Re: [sqlalchemy] What's the difference between the two syntax of declaring index?

2020-07-17 Thread Mike Bayer
On Fri, Jul 17, 2020, at 7:20 AM, Bob Fang wrote: > Hi I have seen two/three ways to declare index on table: > > 1. use index=True > > class Model(Base): > __tablename__ = "model" > id = sa.Column(sa.Integer, primary_key=True) > field_1 = sa.Column(sa.Integer, index=True) > > 2.

[sqlalchemy] What's the difference between the two syntax of declaring index?

2020-07-17 Thread Bob Fang
Hi I have seen two/three ways to declare index on table: 1. use index=True class Model(Base): __tablename__ = "model" id = sa.Column(sa.Integer, primary_key=True) field_1 = sa.Column(sa.Integer, index=True) 2. use __table_args__: class Model(Base): __tablename__ = "model"