Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
XachaB opened this issue Nov 1, 2024 · 0 comments

Comments

@XachaB
Copy link

XachaB commented Nov 1, 2024

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:

if source_res.schema:
source_res.schema.foreign_keys = []

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant