There's two ways:
1. You can put an index=True argument on the Column, such as...
class Foo(Base):
name = Column(types.String, index=True)
2. You can create Index() definitions just like you create Column()
definitions. If you're using 0.6.x, the Index() definition must be outside
of the declarative class definition. For example:
class Foo(Base):
first_name = Column(types.String)
last_name = Column(types.String)
Index('foo_idx', Foo.first_name, Foo.last_name, unique=True)
As of 0.7, you can include the Index object within the table definition.
See http://www.sqlalchemy.org/docs/core/schema.html?highlight=index#indexes
for more.
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.