framework icon indicating copy to clipboard operation
framework copied to clipboard

When inferring foreign keys for a table, the foreign keys of its source table are erased

Open XachaB opened this issue 1 year ago • 0 comments

Overview

Consider three table: A, B, C A has some foreign keys, for example, referring to the identifier in C. B has a foreign key which refers to some column in A (a is the source table).

When doing p.infer() for a package for this database, inside __open_lookup, the foreign keys of A will be erased at this line:

https://github.com/frictionlessdata/frictionless-py/blob/84c3ea0d1c4d498db67a38e89ea9e55af2377dba/frictionless/resources/table.py#L250-L251

I don't understand why: the fact that C refers to A shouldn't mean that A's own foreign keys must be reset ?

I also have the impression that if B referred to itself (with resource being ""), this would erase its own foreign keys relations.

XachaB avatar Nov 01 '24 10:11 XachaB