darktable-org / darktable-org/darktable

Add SQL where statement to collection rules

Open
#19,155 26 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature: enhancement no-issue-activity
Dominant language
C
Stars
13.1k
Forks
1.4k
Avg merge
22h 14m
Merged PRs (30d)
198

Description

There are some (lots) of collections that can't be built using the current collection rules, such as collecting all images shot in a month irrespective of year as was discussed in https://discuss.pixls.us/t/filtering-collection-on-capture-date-but-by-month-only/51621

Describe the solution you'd like
The ability to write a SQL where clause such as strftime("%m", datetime_taken) = '05', which would be appended to select * from images where . The example given would select all images shot in May.

Alternatives
Perhaps a query builder, but I think that would be horribly difficult to make usable without making it huge.

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 by tracing how collection rules become the select * from images where query and identify the entry point that could accept a user-supplied SQL WHERE clause. Check how the example strftime("%m", datetime_taken) = '05' would be represented, and consider the feature complete when a collection can select all images from a month regardless of year.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, sql
Domain
database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.