framework icon indicating copy to clipboard operation
framework copied to clipboard

Foreign Key Validation Errors Not Displaying After Transformations

Open megin1989 opened this issue 11 months ago • 0 comments

Problem:

While using Frictionless to validate data, foreign key-related errors are not being displayed when the cell_convert transformation is applied to specific fields. While other foreign key validation errors are correctly shown, one particular foreign key error is not displayed, even though the reference between resources is incorrect.

Steps to Reproduce:

  1. Use the following common_transform_steps for transforming field values to lowercase:

    common_transform_steps = [ 
        ("ORGANIZATION_TYPE_DISPLAY", "organization_type_display"), 
        ("FACILITY_STATE", "facility_state"),    
    ]
    
  2. Apply the transformation in the following loop:

    for resource in package.resources:
        transform_steps = [
            steps.cell_convert(field_name=field_name, function=lambda value: value.lower())
            for field_name, _ in common_transform_steps
            if any(field.name == field_name for field in resource.schema.fields)
        ]
        resource = transform(resource, steps=transform_steps)
    
  3. Validate the package using Frictionless:

    report = package.validate()
    
  4. Expected Outcome: All foreign key errors, including those related to missing or invalid references, should be displayed.

  5. Actual Outcome: While other foreign key errors are shown, one specific foreign key error (related to the reference between certain fields) does not appear in the validation report, despite the incorrect reference.

Additional Information:

  • The fields being transformed (cell_convert) are not foreign key fields.
  • The foreign key fields are correctly referenced between resources (i.e., primary key and foreign key relations are set up).
  • The issue occurs even after transforming data fields that are not foreign keys.
  • The specific foreign key error that is not showing is related to the relationship_person_code field, where the value in the reference column does not exist in the related resource.

What I Have Tried:

  • Validated the package before and after applying the transformations, but foreign key errors are not showing up for the relationship_person_code field.
  • Ensured that foreign key relationships are correctly defined in the schema.

Request:

I would like to understand if there's a way to ensure that all validation errors, including foreign key violations, are displayed after applying transformations, and if there's a setting to suppress or handle case-sensitivity in the foreign key validation process.

megin1989 avatar Jan 01 '25 13:01 megin1989