Simple coding against Gramps db - examples?

I want to create a tree, exactly like that in Gramps, but for a website, using data from Gramps.
I have already done so, using PHP with a bespoke MYSQL database, which I populated using a lot of tailor made scripts.
I now realise I should have used:

  • Python
  • the standard Gramps API for the db access.
    I have never used Python before - the degree of abstraction seems intimidating, but never mind…
    Where can I find some Python examples of code to:
  • get a Person
  • get their Name
  • Get their Parents
    This is only for myself (but I suspect many others would be interested), so I am not interested in ‘fripperies’ like Internationalisation etc etc.

Have a look at the add_to_tree method in the ancestor gramplet.

Read the Using database API page in the wiki and the API documentation.

1 Like

When you see a report or gramplet that shows data similar to your interest, you can use them as example code. Plugins tend to be small enough that reverse engineering them is easier than core modules.

But locating that module’s source code can be a challenge in the beginning.

Use the Info button in the Plugin Manager to find the path and filename for the module.

Looking at add-on filter rules gives even more focused glimpses.

The SuperTool Addon lets you experiment interactively with the database.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.