Small nit. Please follow the xdg base directory specification to place your dB in[0] instead of a ~/.cq directory.

For the local.db I believe it would be ~/.local/share/cq/local.db.

Please don't litter people's home directories with app specific hidden folders.

[0] https://specifications.freedesktop.org/basedir/latest/