Skip to main content

pythonish-ql

A Pythonish Query Language, for the Gramps Project and other objects.

This project is designed to be a drop-in replacement for https://github.com/DavidMStraub/gramps-ql

Rather than having to build, and learn, a new query language, the idea is to build on top of Python, the native language of the Gramps Project. And, rather than having to convert the Gramps raw data into objects, then dicts, and then back again to objects (when needed), this query system can operate directly on the objects.

Originally, I had extended the syntax of language Python and therefore called this Pythonish. However, currently, the language is pure Python without any change in syntax.

Each object can be identified by its type, eg person, note, family, etc.

Examples:

Find the person with a particular gramps_id:

person.gramps_id == 'person001'

Find all of the people with notes:

person.get_note_list()

Find all of the people with notes that mention 'vote':

any([('vote' in str(get_note(handle).text)) for handle in person.get_note_list()])

Usage

If you don't know what the type is, you can use obj, like:

"23" in obj.gramps_id

You can use standard dot notation to reference any object. Refer to Gramps Primary Objects for the structure of Gramps objects.

You can also use the SimpleAccess methods that make access to some data much easier. The SimpleAccess is available as sa, as shown below.

Select all of the people that have are married to a person named "Donna":

sa.first_name(sa.spouse(person)) == "Donna"

Metadata

Release files for pythonish-ql 0.0.7

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

Built distribution (wheel)

Table of built distributions (wheels) for pythonish-ql 0.0.7
File Interpreter ABI Platform
pythonish_ql-0.0.7-py3-none-any.whl Python 3 none any Details

Release files / pythonish_ql-0.0.7-py3-none-any.whl

Download URL pythonish_ql-0.0.7-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e815267a616d6d78d6970a97e2a380275f252d055ed1457c24a80978ce4243e8
BLAKE2b-256 checksum
How to use checksums
8438c80c6e654cfe427a36fed0d00b7a05a6af88d504480fa908af8d6a8b4460
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.13

Release history Release notifications | RSS feed

This release

0.0.7 This release

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.1

1 release file

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