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 metadata.create_all(), then you don't
need to separately create the index.

-- 
Mike Conley



On Wed, Jul 29, 2009 at 5:34 PM, Lukasz Szybalski <[email protected]>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)
>    name = Column(Unicode(), nullable=False)
>
>
> how do I do index declarative style?
>
> Thanks,
> Lucas
>
>
>
> --
> Using rsync. How to setup rsyncd.
> http://lucasmanual.com/mywiki/rsync
> OpenLdap - From start to finish.
> http://lucasmanual.com/mywiki/OpenLdap
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to