Replies: 1 comment
-
One possible solution would be to add to
sample snippet from yaml: foreignKeys:
# default "check foreignKey regardless of any field value being None"
- fields: [CID, TABCD, LCD]
reference:
resource: locationcodes
fields: [CID, TABCD, LCD]
# explicitly ask for checking foreignKey in all cases
- fields: [CLASS, TCD, STCD]
skipIfNone: False
reference:
resource: subtypes
fields: [CLASS, TCD, STCD]
# To skip foreignKey if any of fields (CID or NID) are None
- fields: [CID, NID]
skipIfNone: True
reference:
resource: names
fields: [CID, NID]
# To skip foreignKey check for records having POL_LCD None
- fields: [CID, TABCD, POL_LCD]
skipIfNone: POL_LCD
reference:
resource: administrativearea
fields: [CID, TABCD, LCD]
# To skip foreignKey check for records having in TABCD or ROADID value None
- fields: [CID, TABCD, ROADID]
skipIfNone: [TABCD, ROADID]
reference:
resource: roads
fields: [CID, TABCD, ROADID] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checking foreignKey on fields helps a lot.
However, if the field to check is not required, the foreignKey check fails with empty values.
Proposal
If
foreignKeys[].fields
contains a field, which is not required, skip the foreign key check for all the records containing None value on those not required fields.This way the foreignKeys would be able detecting broken references (using real values, which are not present in the foreign table), but would not fail in case, we do not want to refer anywhere.
Beta Was this translation helpful? Give feedback.
All reactions