Tan Yi wrote:
> I want to create a table, say:
>    employee_table = Table(
>         'employee',metadata,
>         Column('id',Integer,primary_key=True),
>         Column('name',String(255))
>                        )
>   staffGroup_Table = Table(
>          'role',metadata,
>            Column('manager',None,ForeignKey('employee.id')),
>            Column('worker',None,ForeignKey('employee.id')),
>            Column('janitorr',None,ForeignKey('employee.id'))
>                       )
> metadata.create_all()
>
> however this will generate circular dependency, I tried to use use_alt
> = True with ForeignKey constraint , but no luck.
> What is the correct way of creating table for this kind of situation :
> "a table refers to another table with a composite foreign keys on the
> same column?"

the name of the flag is "use_alter", and there is also no circular
dependency above.  "employee" is created first, "role" second.   there's
also no composite foreign key represented above; a "composite" foreign key
is one that references a "composite" primary key, i.e. a primary key that
consists of more than one column.




>
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@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.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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.

Reply via email to