> -----Original Message----- > From: sqlalchemy@googlegroups.com > [mailto:sqlalch...@googlegroups.com] On Behalf Of asrenzo > Sent: 24 August 2009 13:48 > To: sqlalchemy > Subject: [sqlalchemy] Re: ForeignKey on a ForeignKey > > > Hi King Simon, > > Thanks for your answer but this doesn't solve my problem. > If I comment my parent_id definition in the objects_tree definition, > everything is OK with create_all() invocation. > > If I change the parent_id column definition to : > > sa.Column('parent_id', None, sa.ForeignKey('objects.id', > ondelete='CASCADE', onupdate='CASCADE'), primary_key=True) > > everything is still OK (parent_id is not a foreign key on another > foreign key anymore). But as soon as I try : > > sa.Column('parent_id', None, sa.ForeignKey('objects.parent_id', > ondelete='CASCADE', onupdate='CASCADE'), primary_key=True) > > the create_all() is broken. > > Any idea ? > > Laurent >
Is it still the same error that you are getting (NotImplementedError), or something else? If I run your code against SQLite, I get no errors. If I run it against MySQL, I get the error "BLOB/TEXT column 'name' used in key specification without a key length". If I change your 'name' column to be a String type rather than Text, it runs without a problem. (It looks like I was wrong about the None being required - it works fine without it) Simon --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---