[sqlalchemy] Re: declarative_base vs mapper

2009-07-29 Thread Mike Conley
Here is one approach. I would like to see some way of embedding it in __table_args__, but I haven't been able to figure out that one. t_xyz = xyz.__table__ indx = Index('myindex', t_xyz.c.type, t_xyz.c.name, unique=True) indx.create() or if you put the first 2 lines before

[sqlalchemy] Re: declarative_base vs mapper

2009-07-29 Thread Lukasz Szybalski
On Wed, Jul 29, 2009 at 4:34 PM, Lukasz Szybalskiszybal...@gmail.com wrote: Hello, How can I do Index('myindex', xyz.c.type, xyz.c.name, unique=True) in a declarative way? class xyz(DeclarativeBase):    __tablename__ = 'xyz'    #{ Columns    type = Column(Unicode(), nullable=False)  

[sqlalchemy] Re: declarative_base vs mapper

2009-07-29 Thread Mike Conley
What are the advantages of using declarative way of setting table definitions? vs addressbook_table = sqlalchemy.Table(Addressbook, metadata, sqlalchemy.Column('Address_Sid', sqlalchemy.Integer, primary_key=True), sqlalchemy.Column('FirstName', sqlalchemy.Unicode(40),nullable=False),