gramps-object-query-language
A small, closed query AST and SQL compiler for fast object queries against Gramps genealogy data.
This is not a general query language, not GraphQL, and not a raw-SQL
passthrough. It compiles a structured Query (select/where/order_by/
limit/after) -- or an "almost Python" expression string -- into
parameterized SQL against Gramps' flattened secondary columns, with every
column checked against a fixed per-type whitelist before the compiler ever
touches it.
It is standalone and privacy-agnostic: it carries no knowledge of proxies,
permissions, or any particular web API. An evaluator/proxied_query path
is also included for evaluating the same query AST directly against real
(possibly proxied) Gramps objects, for callers that can't run raw SQL
against an unproxied database.
Install
pip install gramps-object-query-language
Documentation
README-query-language.md-- a plain-language, goal-first guide towhere_exprfor non-programmers ("Find all the families where the mom died before the dad" -> the query for it).docs/where_expr.md-- the technical reference for the "almost Python"where_exprfilter language (Person "gender == Person.MALE",Family "mother.death.date.sortval < father.death.date.sortval", ...), with every example tested against real SQLite.
Modules
gramps_object_query_language.query-- the query AST and SQL compiler.gramps_object_query_language.query_lang-- an "almost Python" expression parser (parse_expr) that translates into the samewhereshape, pluscompile_expr, which translates it the rest of the way intoquery.py's executable AST for callers that want to run it directly. Seedocs/where_expr.md.gramps_object_query_language.evaluator-- evaluates the AST directly against real Gramps objects (no SQL), for use with a proxied database.gramps_object_query_language.proxied_query-- runs awhereexpression through Gramps' ownFilter/Rulemachinery against a possibly-proxied database.
Development
pip install -e ".[test]"
pytest
License
GNU Affero General Public License v3 or later (AGPL-3.0-or-later). See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gramps_object_query_language-0.3.3.tar.gz.
File metadata
- Download URL: gramps_object_query_language-0.3.3.tar.gz
- Upload date:
- Size: 60.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b997295f40ebc50824406acbff01a33af71ef77cdb2a6f90dce226076eb3d24d
|
|
| MD5 |
e198ec7c7043cc7a1f79fe0931e9a974
|
|
| BLAKE2b-256 |
5fa21735b7ec95c693d0315b43a3c373441115fab5080dbc0a69d3a1f3bc43dc
|
File details
Details for the file gramps_object_query_language-0.3.3-py3-none-any.whl.
File metadata
- Download URL: gramps_object_query_language-0.3.3-py3-none-any.whl
- Upload date:
- Size: 63.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc478e51e4aaa7c5ab348ac0150be9be88058938e8e02fbc4f887260a0212980
|
|
| MD5 |
3cfca9bc334f9fb85f5260fa37aa21d3
|
|
| BLAKE2b-256 |
eb1c2aed4e513c9c787d6501ed53db96c79aa96213c633e27b611c9ccf754ea4
|