Skip to content

Table Validation when using Foreign Keys #135

@baalmael

Description

@baalmael

Currently, when a validating a Schema against a Table an UnsupportedOperationException is thrown if the Schema defines foreign keys to another resource.

java.lang.UnsupportedOperationException: Foreign key references across package resources are not supported

	at io.frictionlessdata.tableschema.fk.ForeignKey.validate(ForeignKey.java:148)
	at io.frictionlessdata.tableschema.schema.Schema.validate(Schema.java:657)
	at io.frictionlessdata.tableschema.Table.validate(Table.java:634)

This means validating headers, primary keys and foreign keys (in resource) is not supported for this usecase (without an exception) without implementing workarounds such as removing all foreign keys before calling table.validate().

I would suggest either:

  • Adding real Foreign key validation (not really possible on Table level). See: Support foreign key checks and dereferencing datapackage-java#4
  • Split the validation (for example: validateHeaders(), validatePrimaryKeys(), validateForeignKeys(boolean ignoreCrossResource). This would also help with clarity in terms of what is validated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions