metabase / metabase/metabase

Use sub-components of datetime field filters

Open
#28,762 2 comments 20 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Querying/Parameters & Variables Type:New Feature
Dominant language
Clojure
Stars
49.3k
Forks
6.8k
Avg merge
1d 13h
Merged PRs (30d)
653

Description

**Is your feature request related to a problem? Please describe.**
Let's say I have the following SQL question

```
SELECT count(*) AS count,
(SELECT MIN("public"."database"."crm_date") FROM "public"."database" WHERE {{date_range}}) AS "start_date",
(SELECT MAX("public"."database"."crm_date") FROM "public"."database" WHERE {{date_range}}) AS "end_date",
```

... and the date_range filter is a field filter with a date range

There are users who would like to use some components of the date_range filter, so they can call, for example date_range.start or date_range.end to use those components across the query

**Describe the solution you'd like**
Have the possibility of using the components of the field filters

**Describe alternatives you've considered**
None

**How important is this feature to you?**
Requested in Discourse

**Additional context**
NA

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the date_range field filter and the SQL template-processing path that handles field filters; no source file or test is named in the issue. Define how components such as date_range.start and date_range.end should be exposed across the query, then verify the behavior against the provided MIN/MAX SQL example.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure, sql
Domain
backend-api-design, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.