don't know why you'd be using beta1 when we're up to beta3.....heres a fully
working example:
from sqlalchemy import *
from sqlalchemy.schema import *
metadata = MetaData()
c1 = Table('category', metadata,
Column('name', String (64), nullable=False ),
PrimaryKeyConstraint('name', name='somename')
)
c2 = Table('category2', metadata,
Column('name', String (64), nullable=False ),
Column('name2', String (64), nullable=False ),
PrimaryKeyConstraint('name', 'name2', name='somename')
)
print DropConstraint(c1.constraints.pop())
print DropConstraint(c2.constraints.pop())
On Apr 14, 2010, at 9:40 PM, Gerry Reno wrote:
> Ok, I tried with the keyword but I get this using 0.6beta1:
>
> PrimaryKeyConstraint(id='id'),
> File "/usr/lib/python2.5/site-packages/sqlalchemy/schema.py", line
> 1391, in __init__
> super(ColumnCollectionConstraint, self).__init__(**kw)
> TypeError: __init__() got an unexpected keyword argument 'id'
>
>
> -Gerry
>
>
> On Apr 14, 9:28 pm, Gerry Reno <[email protected]> wrote:
>> What do I do then for a composite primary key?
>>
>> PrimaryKeyConstraint('col1','col2')
>>
>> -Gerry
>>
>> On Apr 14, 9:13 pm, Michael Bayer <[email protected]> wrote:
>>
>>
>>
>>> PrimaryKeyConstraint(name='name')
>>
>>> On Apr 14, 2010, at 8:22 PM, Gerry Reno wrote:
>>
>>>> category = Table('category', metadata,
>>>> Column('name', String (64), nullable=False ),
>>>> ...
>>>> PrimaryKeyConstraint('name'),
>>>> )
>
> --
> 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.
>
--
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.