Propose new syntax for constraints#42
Conversation
lwjohnst86
left a comment
There was a problem hiding this comment.
Really like that assertions are built into the metadata, as that would make updating and checking the data so much easier 👍
| constraints: | ||
| - required | ||
| - assert: LENGTH(postcode) <= 10 |
There was a problem hiding this comment.
Nice idea. This actually solves a problem we were trying to resolve with our check-datapackage. If this is built into the spec, it would solve a lot of our problems trying to work around the current tooling. 👍 One worry we had was how to prevent some type of injection against if the assertion gets evaluated. But I guess that can be sanitized before evaluating.
|
|
||
| ### Assertions | ||
|
|
||
| An `assert` expression is a single-table, row-level boolean expression written in a small SQL-like sublanguage. It is evaluated against every row, and the constraint holds when the expression is true for all of them. Bare names refer to columns of the table. |
There was a problem hiding this comment.
I like that it is SQL-like. SQL is basically the language of data and is so widely used in e.g. data engineering. 👍
|
I think it would make sense to properly formalize the grammar. |
#10