On Monday 03 September 2007 19:57:54 voltron wrote: > would this work? > > users = Table("users", metadata, > Column("id", Integer, primary_key=True), > Column("username", String(50), unique=True, > nullable=False), > Column("password", String(255)), > Column("email", String(255), unique=True, > nullable=False), > Column("firstname", String(255)), > Column("lastname", String(255)), > > Column("modifiedby_id", Integer, ForeignKey("users.id")) > Column("modifiedon", DateTime(timezone=True), > default=func.now()), > > On Sep 3, 6:50 pm, voltron <[EMAIL PROTECTED]> wrote: > > Excuse the newbie question, how does one declare a > > sef-referencing key? I would like to have fields "modified_by" > > and "created_by" in my users table, the field should refer back > > to the user id or user name in the same table. > > > > Thanks
yes, foreign key + eventualy use_alter=True if u get cyclic --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---