Skip to main content

digikuery is a script to perform queries in digikam (photo manager) database.

It can

  • Query albums which contains tags matching a given regex
  • Query most used tags and corresponding albums
  • Print other tags present in matching albums
  • List digikam database structure
  • Provide an interactive python shell for manual queries

Usage

usage: digikuery.py [-h] [-d DBPATH] [-F] [-R ROOT] [-T [FILTER_TAGS]] {shell,schema,album,tag,stats} ...

digikuery - Digikam database query tool - v20230529

positional arguments:
  {shell,schema,album,tag,stats}
    shell                       spawn ipython shell to explor digikam database
    schema                      dump digikam database schema
    album               [album] list tags for one or all albums
    tag                 [tag]   list all tags or query single tag
                        -C      sort by result count
                        -I      show image details
    stats                       show digikam database statistics (default)

options:
  -h, --help            show this help message and exit
  -d DBPATH, --dbpath DBPATH
                        database path
  -F, --full-tagname    display full tag name
  -R ROOT, --root ROOT  restrict query to this root album
  -T [FILTER_TAGS], --filter-tags [FILTER_TAGS]
                        show and filter tags for displayed albums

examples:
List albums when tag 'Paquerette' is present, together with other tags of this album
$ digikuery tag Paquerette

Install

$ pip install digikuery

Example: Query which albums contain given tag expression

Bellow we look for the "semaphore" name in all tags.

The query returns 2 tags "TagCommunication/Semaphore/Bleu" and "TagAlphabet/Semaphore", listing for each tag the albums containing tagged pictures.

$ digikuery tag semaphore
  3 TagCommunication/Semaphore/Bleu
      album_albanie
      album_france
      album_grece
  1 TagAlphabet/Semaphore
      album_photos_19e_siecle

Providing -I option would list the picture names.

Let's just sort them by picture count:

$ digikuery tag -C semaphore
  3 TagCommunication/Semaphore/Bleu
      3 album_france
      2 album_grece
      2 album_albanie
  1 TagAlphabet/Semaphore
      19 album_photos_19e_siecle

For each matching album we can show if it contains other tags, for example tags maching "access"

$ digikuery -T access tag semaphore
  3 TagCommunication/Semaphore/Bleu
      album_france
        TagAccess/Walking (9), TagAccess/Train(1)
      album_grece
		TagAccess/Car(6), TagAccess/Walking (3)
      album_albanie
		TagAccess/Walking (5)

Interactive shell in database

$ digikuery shell
Interactive mode help:
   available objects
      dk.session
         dk.session.query(Album).count()
         dk.session.query(AlbumRoot).all()
         dk.session.query(Image).filter(Image.name == 'example.png').all()
         dk.session.query(Album, Tag, sqlalchemy.func.count(Tag.name)).join(imagetag).join(Image).join(Album)
      dk.engine
         access sqlalchemy engine
      dk.metadata
         access sqlalchemy metadata
   available functions
      help()
         print this message
      dk.query_album(album)
      dk.query_tag(tag)
      dk.schema()
      dk.stats()
running ipython...

In [1]:

Internals

digikuery uses sqlalchemy to map digikam database to python objects.

Metadata

Release files for digikuery 20230529.post2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for digikuery 20230529.post2
File Size Uploaded
digikuery-20230529.post2.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for digikuery 20230529.post2
File Interpreter ABI Platform
digikuery-20230529.post2-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / digikuery-20230529.post2.tar.gz

Download URL digikuery-20230529.post2.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
475c1fe80a58a50bf7516cb0fa86056619fd69ee8cf2375a8a32ab878a505e4f
BLAKE2b-256 checksum
How to use checksums
903a24527dff32f73c8f4a176bc6d11066324a90323e12743d1059d1933e6d6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / digikuery-20230529.post2-py3-none-any.whl

Download URL digikuery-20230529.post2-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b5dc5b9d11b75e24e45285ef1fd38456e9a3705117843a162c367c1edcf3725
BLAKE2b-256 checksum
How to use checksums
b3e187734793633aaaf6991aacc46f0e41b5487af2888e9aa9a8aa8466a09094
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

20230529.post2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page