-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
ForeignKey.validate(Table table) implements something like a foreign key check for self-referencing FK but it does not work correctly.
Let me explain:
In the tests there is this schema (population_schema_for_fk_check.json):
{
"fields": [
...
],
"foreignKeys": [
{
"fields": ["check_city", "check_year"],
"reference": {
"resource": "",
"fields": ["city", "year"]
}
}
]
}
When we run the test with the following Data the test show a false negative:
False Negative Data:
| city | year | population | check_city | check_year |
|---|---|---|---|---|
| london | 2017 | 8 780 000 | paris | 2017 |
| paris | 2017 | 2 240 000 | paris | 2017 |
Result: io.frictionlessdata.tableschema.exception.ForeignKeyException: Foreign key [check_city-> city] violation : expected: paris found: london
The implementation checks if the value of the foreign key is the same as the reference in the same row which is not how foreign keys work.
Metadata
Metadata
Assignees
Labels
No labels