framework icon indicating copy to clipboard operation
framework copied to clipboard

Composite primary key accepts missing values in key fields

Open fjuniorr opened this issue 2 years ago • 0 comments

Here's a reprex:

from frictionless import validate

descriptor = {
    'resources': [
        {
            'name': 'name',
            'data':  [
                ['id1', 'id2'],
                ['a', '1'],
                ['a', None],
            ],
            'schema': {
                'fields': [
                    {'name': 'id1'},
                    {'name': 'id2'},
                ],
                'primaryKey': ['id1', 'id2']
            }
        }
    ],
}
report = validate(descriptor)

From my understanding[^1] report.valid should be False because primary key columns cannot have null values but it returns True in frictionless==5.16.0.

[^1]: The pattern Table Schema: Unique constraints that came from https://github.com/frictionlessdata/specs/issues/593 supports the case in which we need to prevent duplicates and store NULL values.

fjuniorr avatar Jan 22 '24 15:01 fjuniorr