Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote the Unique Constraints pattern to the Table Schema spec? #862

Closed
roll opened this issue Jan 3, 2024 · 2 comments · Fixed by frictionlessdata/datapackage-v2-draft#30
Assignees
Milestone

Comments

@roll
Copy link
Member

roll commented Jan 3, 2024

Overview

Pattern - https://datapackage.org/patterns/unique-constraints/

Although, this pattern doesn't have known implementations, settings multi-column unique values are very vital part of tabular constraints in many systems (e.g. SQL)

@roll roll added this to the v2 milestone Jan 3, 2024
@nichtich
Copy link
Contributor

nichtich commented Jan 4, 2024

Agreed but https://datapackage.org/patterns/unique-constraints/ does not properly explain multi-column unique constraints. I guess these two schemas are equivalent (if so, is there a preferred form?):

{ "fields": [ { "name": "a", "unique": true } ] }
{ "fields": [ { "name": "a" } ],  "uniqueKeys": ["a" ] }

but how about these:

{
  "fields": [ { "name": "a", "unique": true }, { "name": "b", "unique": true } ],
  "uniqueKeys": ["a","b"]
}
{
  "fields": [ { "name": "a" }, { "name": "b" } ],
  "uniqueKeys": ["a","b"]
}

Maybe require uniqueKeys to have at least two elements?

@roll
Copy link
Member Author

roll commented Jan 4, 2024

I agree I think we need to slightly improve the definition if adding to the specs. The main decision will be clarifying behavior in case of duplication as in above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants