I am not a Darktable developer either, but I have some small experience with accessing the database raw (I sometimes run analyses over my Darktable library using R). For starters:
* While running Darktable, you can access the database for reading, but not writing. * The SQLite3 command '.schema' will print a full description of all the tables in the open database. * 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'. * In the Darktable source file 'collect.c' [1] <https://github.com/darktable-org/darktable/blob/master/src/libs/collect.c> you can examine most of the database queries that the collect module uses. Re: scripts breaking, I have only had mine break a few times; as I recall, the last time the tag arrangement was significantly changed was in version 2.2, to move unused tags from 'library.db' to 'data.db'. -- August Schwerdfeger aug...@schwerdfeger.name On Wed, Jan 22, 2020 at 11:37 AM <dt-l...@stefan-klinger.de> wrote: > Greg Minshall (2020-Jan-21, excerpt): > > now: i'd like to have a command line lua script that quickly (i have 32K > > images) lists all the images with a given, e.g., tag, or date, or ... > > i.e., the things one can specify when creating a collection. > > Note: I'm *not* a developer! > > AFAIK, Darktable heavily relies on an an SQLite database > > $ cd ~/.config/darktable > $ file library.db > library.db: SQLite 3.x database, last written using SQLite version > 3030001 > > Which you may query (and mess up) using appropriate tools, e.g., > `sqlite3`, see its man page. You will need to use SQL for that, and > understand Darktable's internal database schema. It's easy to get the > images with ISO > 1600 > > $ sqlite3 library.db > sqlite> select filename from images where iso > 1600; > > but tags probably involve a join and a deeper understanding of the > schema. Which may, and probably will, change between Database > versions. So be prepared for your script to break. > > Note that you probably cannot run Darktable and `sqlite3` at the same > time. > > Cheers, > Stefan > > > PS: Post here when you find out how tags are stored in the DB... > > > -- > 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 > > ____________________________________________________________________________ darktable user mailing list to unsubscribe send a mail to darktable-user+unsubscr...@lists.darktable.org