(table1: Table, table2: Table)
return c1.union(c2)
Return a set of foreign key constraints the two tables have against each other.
Return a set of foreign key constraints the two tables have against each other.
Return a set of foreign key constraints the two tables have against each other .
def get_common_fk_constraints(table1: Table, table2: Table) -> set[ForeignKeyConstraint]:
    """Return a set of foreign key constraints the two tables have against each other."""
    c1 = {c for c in table1.constraints if isinstance(c, ForeignKeyConstraint) and
          c.elements[0].column.table == table2}
    c2 = {c for c in table2.constraints if isinstance(c, ForeignKeyConstraint) and
          c.elements[0].column.table == table1}
    return c1.union(c2)
def get_common_fk_constraints ( table1 : Table , table2 : Table ) -> set [ ForeignKeyConstraint ] : c1 = { c for c in table1 . constraints if isinstance ( c , ForeignKeyConstraint ) and c . elements [ 0 ] . column . table == table2 } c2 = { c for c in table2 . constraints if isinstance ( c , ForeignKeyConstraint ) and c . elements [ 0 ] . column . table == table1 } return c1 . union ( c2 )