August Schwerdfeger (2020-Jan-22, excerpt):
> * Tags are stored in the (library) database in the table 'used_tags', with
> a name and ID. The tag/image relation is established by pairs of IDs in the
> table 'tagged_images'.

Ah, thanks.  I could not find the `used_tags` table, turned out it is
in `data.db`, not `library.db` (any reason for that known?), but I'm
on Darktable 3 now, maybe that has changed.

> On Wed, Jan 22, 2020 at 11:37 AM <dt-l...@stefan-klinger.de> wrote:
> > but tags probably involve a join and a deeper understanding of the
> > schema.

That would be

    $ cd ~/.config/darktable
    $ sqlite3 
    sqlite> attach 'data.db' as data;
    sqlite> attach 'library.db' as lib;
    sqlite> select i.filename, t.name
            from
               lib.images as i
               inner join lib.tagged_images as r on i.id = r.imgid
               inner join data.tags as t on r.tagid = t.id
            where t.name = 'vögel'
            ;     

to get all image names with tag 'vögel'.  Note that you'll need more
joining to get the path names to the file names...



-- 
Dr. Stefan Klinger -- Informatiker, Mathematiker              o/X
https://stefan-klinger.de                                     /\/
I prefer receiving plain text messages, not exceeding 32kB.     \
____________________________________________________________________________
darktable user mailing list
to unsubscribe send a mail to darktable-user+unsubscr...@lists.darktable.org

Reply via email to