How do I get the handle for a source with a specific attribute

I want to look for a source with an attribute called AID with a specific value. I want to get its handle. How do I do this?

I have made a plugin who’s functionality I am trying to extend, but I have a hard time wrapping my head around querying the database.

(v. 6.0 Windows 11)

In the following thread, there is a discussion about needing to search for any objects having an Attribute name with a particular value.

There is a SuperTool script (by @kku) demonstrating python code to do that. It uses some SuperTool specific methods (like getargs() user input dialogs)… so that SuperTool script is not copy’n’paste chunks of code.

You may also find the Attributes section of the Sphinx-driven Gramps developer docs useful. (The site is showing some some latency today. So it and @gramps-project are probably defending against a DoS attack. Please have patience. )

1 Like