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

Feature request: number of records constraints #820

Closed
aborruso opened this issue Apr 23, 2021 · 14 comments · Fixed by #958
Closed

Feature request: number of records constraints #820

aborruso opened this issue Apr 23, 2021 · 14 comments · Fixed by #958
Assignees
Labels
feature New functionality good first issue Good for newcomers

Comments

@aborruso
Copy link
Contributor

Overview

Hi,
below you have one of the official documentation yaml file. There some constraints fields related.

A lot of time I know that I know that a resource is valid only if it is made up of at least 365 rows (some annual dataset including leap years). Or that the rows shouldn't be more than 10.

I think it should be a great validate and check feature to have.

Thank you

dialect:
  delimiter: ;
encoding: utf-8
format: csv
hashing: md5
layout:
  headerRows:
    - 2
name: country-2
path: country-2.csv
profile: tabular-data-resource
schema:
  fields:
    - name: id
      title: Identifier
      type: integer
    - name: neighbor_id
      title: Identifier of the neighbor
      type: integer
    - name: name
      title: Name of the country
      type: string
    - constraints:
        minimum: 0
      description: According to the year 2020's data
      name: population
      title: Population
      type: integer
  foreignKeys:
    - fields:
        - neighbor_id
      reference:
        fields:
          - id
        resource: ''
scheme: file

Please preserve this line to notify @roll (lead of this repository)

@roll
Copy link
Member

roll commented Apr 23, 2021

@aborruso
Regarding an API. Have I understood your idea correctly if I see it as something like a checks.table_dimension check:

table_dimension
    minimum_fields?
    maximum_fields?
    minimum_rows?
    maximum_rows?
    number_rows?

@roll roll added the feature New functionality label Apr 23, 2021
@aborruso
Copy link
Contributor Author

The maximum_fields probably is not necessary, because in the schema you have exactly the required fields, you can't have more and you can't have less. The number of lines is variable and you should have some constraints.

Than

minimum_rows
maximum_rows

Thank you

@aborruso
Copy link
Contributor Author

And probably also number_rows to set a fixed one

@roll
Copy link
Member

roll commented Apr 23, 2021

Fields limit might be useful for cases when a schema is not provided so probably it will make sense to provide these options as well (while it's very easy)

@roll
Copy link
Member

roll commented Apr 23, 2021

And probably also number_rows to set a fixed one

👍

@aborruso
Copy link
Contributor Author

Wow, thank you very much @roll !!!

@roll
Copy link
Member

roll commented Dec 22, 2021

@aborruso
Thanks to @aivuk 😃

@aborruso
Copy link
Contributor Author

@roll Is there a new documentation section, on how to use it?

@roll
Copy link
Member

roll commented Dec 22, 2021

@aborruso
Thanks, for the heads-up, we're on it 👍

@roll
Copy link
Member

roll commented Dec 23, 2021

@aborruso
Copy link
Contributor Author

@roll as usual, you are very kind. Thank you

@aborruso
Copy link
Contributor Author

https://framework.frictionlessdata.io/docs/guides/validation-checks/#table-dimensions

@roll how to run via cli this check? In example num_rows=5.

Thank you

@roll
Copy link
Member

roll commented May 14, 2022

Hi @aborruso,

I've created a feature request for it - #1078 - we will be on it soon

@aborruso
Copy link
Contributor Author

I've created a feature request for it - #1078 - we will be on it soon

WOW, really great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality good first issue Good for newcomers
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants