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

Implement grouping options for date & time types #429

Closed
Tracked by #250
kgodey opened this issue Jul 18, 2021 · 0 comments · Fixed by #1458
Closed
Tracked by #250

Implement grouping options for date & time types #429

kgodey opened this issue Jul 18, 2021 · 0 comments · Fixed by #1458
Assignees
Labels
ready Ready for implementation type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL
Milestone

Comments

@kgodey
Copy link
Contributor

kgodey commented Jul 18, 2021

Problem

Users may want to group their records with date and time fields by common intervals such as hours, months, quarters, years, etc. The appropriate grouping for a field will vary depend on the kind of data stored in that field. For example, if there are years ranging from 1500-2000 in the data, the user might want to group dates by century, but if the dates only range from 2008-2010, the user may want to group by month or quarter instead and centuries are useless.

We need to provide both useful grouping intervals for a given column and the ability to group by them.

Solution

  • We should support grouping by all valid date parts supported by Postgres' EXTRACT function. Documentation.
  • We should provide useful grouping intervals for a given column in the Column API.
  • We should extend our record grouping mechanism to accept date parts for columns of Date & Time types. We should only accept valid date parts based on the type of column (e.g. we should not accept century for TIME columns).

This involves:

  • Implementing the grouping in the backend
  • Updating the /api/v0/databases/<id>/types/ endpoint to store available grouping on this type

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready Ready for implementation type: enhancement New feature or request work: backend Related to Python, Django, and simple SQL
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants