[sqlalchemy] Re: index in SA

2009-08-22 Thread Michael Bayer
[mailto:sqlalch...@googlegroups.com] On Behalf Of rajasekhar911 Sent: 21 August 2009 07:30 To: sqlalchemy Subject: [sqlalchemy] Re: index in SA i want to add a composite index to the class inherited from declarative_base I tried this, class MyClass: __tablename__ = 'my_table' id

[sqlalchemy] Re: index in SA

2009-08-21 Thread rajasekhar911
i want to add a composite index to the class inherited from declarative_base I tried this, class MyClass: __tablename__ = 'my_table' id = Column(Integer, primary_key=True) name = Column(String, nullable=False) type = Column(String, nullable=False) __table_args__ = (

[sqlalchemy] Re: index in SA

2009-08-21 Thread rajasekhar911
...@motorola.com wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of rajasekhar911 Sent: 21 August 2009 07:30 To: sqlalchemy Subject: [sqlalchemy] Re: index in SA i want to add a composite index to the class inherited

[sqlalchemy] Re: index in SA

2009-08-21 Thread rajasekhar911
...@googlegroups.com] On Behalf Of rajasekhar911 Sent: 21 August 2009 07:30 To: sqlalchemy Subject: [sqlalchemy] Re: index in SA i want to add a composite index to the class inherited from declarative_base I tried this, class MyClass:    __tablename__ = 'my_table'     id = Column

[sqlalchemy] Re: index in SA

2009-08-21 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of rajasekhar911 Sent: 21 August 2009 10:25 To: sqlalchemy Subject: [sqlalchemy] Re: index in SA i tried class MyClass: __tablename__ = 'my_table' id = Column

[sqlalchemy] Re: index in SA

2009-08-21 Thread rajasekhar911
exactly On Aug 21, 2:33 pm, King Simon-NFHD78 simon.k...@motorola.com wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of rajasekhar911 Sent: 21 August 2009 10:25 To: sqlalchemy Subject: [sqlalchemy] Re: index in SA

[sqlalchemy] Re: index in SA

2009-08-20 Thread Gregg Lind
If you need to use some SQL is that is not supported by UniqueConstraint, PrimaryKeyConstraint and friends, you can use the DDL statement: # DDL to only run on postgres, incorporating declarative style from sqlalchemy.schema import DDL DDL('''ALTER TABLE orgdata ADD

[sqlalchemy] Re: index in SA

2009-08-20 Thread Michael Bayer
this is usually accomplished using Index(). see the metadata docs for details. On Aug 20, 2009, at 12:35 PM, rajasekhar911 wrote: Hi Is it possible to add index to my table using sqlalchemy? Or should i do it directly on the database? Thanks..