The problem

I use the Hydrus Network as my media archival and tagging tool of choice. It’s where I keep copies of my shows, family photos, and archives of art I like from places like DeviantArt or ArtStation.

Hydrus has a configurable 'rating system', where by default you have a simple dislike/like button for every image.

I use this to represent my curated favourites.

Something I often wonder is, 'how many artists have I favourited just one or two pictures from, but I’ve never looked at the rest of their work, even though I’d probably enjoy a lot of it'?

Hydrus’s tagging system unfortunately doesn’t support this kind of deep query, so I worked with GPT-5 over half an hour to make a SQL script I could run against my local database.

Just show me the script

AI slop warning:

-- Run this from client.db
ATTACH 'client.mappings.db' AS mappings;
ATTACH 'client.master.db'   AS master;

-- 1) Identify the like-rating service (your "favourites")
WITH like_service AS (
  SELECT service_id
  FROM services
  WHERE service_type = 7          -- Like/Dislike rating service
    AND name = 'favourites'       -- adjust if you renamed it
  LIMIT 1
),

-- 2) Files that are 'liked'
--    For Like/Dislike ratings in local_ratings, liked is typically rating > 0.
liked_files AS (
  SELECT lr.hash_id
  FROM local_ratings AS lr
  JOIN like_service ls USING (service_id)
  WHERE lr.rating IS NOT NULL AND lr.rating > 0
),

-- 3) Creator-tag mappings from your "my tags" service (service_id = 9)
creator_maps AS (
  SELECT cm.hash_id,
         t.subtag_id
  FROM mappings.current_mappings_9 AS cm        -- service_id 9 = "my tags"
  JOIN master.tags       AS tg  ON tg.tag_id = cm.tag_id
  JOIN master.namespaces AS ns  ON ns.namespace_id = tg.namespace_id
  JOIN master.subtags    AS t   ON t.subtag_id   = tg.subtag_id
  WHERE ns.namespace = 'creator'
),

-- 4) Count how many files each creator has (globally)
creator_counts AS (
  SELECT subtag_id, COUNT(DISTINCT hash_id) AS total_files_for_creator
  FROM creator_maps
  GROUP BY subtag_id
),

-- 5) Keep only creators with < 5 files
small_creators AS (
  SELECT subtag_id
  FROM creator_counts
  WHERE total_files_for_creator < 5
)

-- 6) Final selection: liked files that have a creator in small_creators
SELECT
  lf.hash_id,
  st.subtag                  AS creator,
  cc.total_files_for_creator AS creator_file_count

  -- OPTIONAL: uncomment these two lines to include sha256 hex
  -- , LOWER(HEX(h.hash))     AS sha256

FROM liked_files lf
JOIN creator_maps cm          ON cm.hash_id = lf.hash_id
JOIN small_creators sc        ON sc.subtag_id = cm.subtag_id
JOIN master.subtags st        ON st.subtag_id = cm.subtag_id
JOIN creator_counts cc        ON cc.subtag_id = cm.subtag_id

-- OPTIONAL: uncomment this to include sha256 hex (requires schema master.hashes(hash_id, hash BLOB))
-- JOIN master.hashes h         ON h.hash_id = lf.hash_id

GROUP BY lf.hash_id, st.subtag, cc.total_files_for_creator
ORDER BY cc.total_files_for_creator ASC, st.subtag ASC, lf.hash_id ASC;

Place it in the db folder of your Hydrus installation, and run like so: sqlite3 client.db < find_artists.sql.

It will output a list of artist names where you’ve favourited at least one image attributed to them, but have less than five total images from them in your library.

I make no claim that this will work in your installation without tweaks.

Additionally, even though this is pure SELECT statements and thus should have no mechanism for harming your Hydrus installation, I take no liability if you somehow nuke your treasured childhood photos with this.