Skip to content

Problem with foreign keys #8

@jschultz

Description

@jschultz

I have stumbled on a bug that appears to be in sqlalchemy-sqlany, as it only appears to occur with SQL Anywhere databases. I reported the problem on the sqlalchemy Google group here.

In brief, doing reflection on certain tables, I receive the exception:

sqlalchemy.exc.ArgumentError: ForeignKeyConstraint with duplicate source column references are not supported.

The table in question does have foreign keys, but none with duplicate source columns:

ALTER TABLE test.wiwalisataob2aaf.Annotation
ADD FOREIGN KEY (Item_Id)
REFERENCES Item (Id);

ALTER TABLE test.wiwalisataob2aaf.Annotation
ADD FOREIGN KEY (CreatedBy,ModifiedBy)
REFERENCES UserProfile (Id,Id);

ALTER TABLE test.wiwalisataob2aaf.Annotation
ADD FOREIGN KEY (CompoundSourceRegion_Id,Item_Id)
REFERENCES CompoundSourceRegion (Id,Item_Id);

The problem seems to concern the way that foreign key constraints are detected or handled, but that's about all I know so far. I'll have a go debugging the problem myself, but any assistance or pointers would be most welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions