Hi,
I have two tables; one of them refers to the first one with a "foreignkey".
I need the "on delete" clause, how can I do with sqlalchemy?
I saw in the documentation that it is possible with mappers
(cascade='delete'); must I use mappers? can't I do without them?
And if I use the mappers, is the code good for sqlite? As far I know,
sqlite doesn't implement foreignkeys, but sqlalchemy can add a magic
layer.. I have found anything regarding sqlite limitations with sqlalchemy.
Here my code (simplified):
enginedbcom = create_engine('mysql://[EMAIL PROTECTED]/schema')
dbcom = BoundMetaData(enginedbcom)
users2 = Table('users2', dbcom,
Column('name', String(30), nullable=False, primary_key=True),
Column('password', String(30)),
mysql_engine='InnoDB')
groups = Table('groups', dbcom,
Column('name', String(30), nullable=False, primary_key=True),
mysql_engine='InnoDB')
rooms = Table('rooms', dbcom,
Column('name', String(30), nullable=False, primary_key=True),
mysql_engine='InnoDB')
usersVSgroups = Table('usersVSgroups', dbcom,
Column('username', String(30),
ForeignKey("users2.name"), nullable=False),
Column('groupname', String(30),
ForeignKey("groups.name"), nullable=False),
mysql_engine='InnoDB',
)
Thanks
Alessandro
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users