froGQL
Embedded GQL graph database with single-file storage. Rust core, Python bindings via PyO3.
froGQL implements ISO GQL path pattern matching: MATCH, comma-joins, unions, repetitions ({n,m}), OPTIONAL MATCH, EXISTS / NOT EXISTS, WHERE, RETURN, LIMIT. The runtime uses Leapfrog Triejoin (CompactLTJ) as its primary join strategy — worst-case-optimal for multi-way joins, with measured 14×–4000× speedups over pairwise hash-join on social-graph workloads.
Install
pip install frogql
Wheels ship for CPython 3.8+ on Linux (x86_64, aarch64), macOS (x86_64, arm64), and Windows (x86_64).
Quick start
import frogql
# Open or create a .gdb database
conn = frogql.open("movies.gdb")
# Run a query — returns a list of {alias: value} dicts.
# Use `AS name` in RETURN to pick the dict key; otherwise the
# projection falls back to col0, col1, ...
rows = conn.execute(
"MATCH (p:Person)-[:ACTED_IN]->(m:Movie) "
"WHERE m.released = 1999 "
"RETURN p.name AS actor, m.title AS title",
limit=10,
)
for row in rows:
print(row["actor"], "->", row["title"])
# Inspect the graph
print(conn.node_count, conn.edge_count)
print(conn.schema())
Bare patterns (no RETURN)
A query without RETURN projects each row as a dict of the matched
variables plus a special _paths key holding the full match:
rows = conn.execute("(p:Person)-[:ACTED_IN]->(m:Movie)", limit=1)
row = rows[0]
row["p"] # {"kind": "node", "id": ..., "labels": [...], "props": {...}}
row["m"] # the movie node
row["_paths"] # [[node_p, edge, node_m]] — list of paths, each a
# list of node/edge dicts in match order
_paths is a list because comma-joined patterns produce one path per
joined sub-pattern. For a single pattern, _paths[0] is the full path.
Data import
# From JSON
frogql.import_json("graph.gdb", "graph.json")
# From a CSV directory with spanner_import_config.json
frogql.import_csv("graph.gdb", "path/to/csv_dir/")
Graph types and indexes
The catalog persists inside the .gdb file. DDL is plain GQL:
conn.execute("CREATE GRAPH TYPE movies { (:Movie {title STRING, released INT}) }")
conn.execute("USE GRAPH TYPE movies")
conn.execute("VALIDATE GRAPH TYPE movies")
conn.execute("CREATE BTREE INDEX ON :Movie(released)")
A DEFAULT graph type is auto-inferred at import time. Auto-built secondary indexes (hash + btree) cover unique (label, prop) pairs and are picked up by the optimizer for constant-folding and range filters.
API surface
| Call | Returns |
|---|---|
frogql.open(path) |
Connection |
frogql.import_json(db_path, json_path) |
None |
frogql.import_csv(db_path, csv_dir) |
None |
Connection.execute(query, limit=0) |
list[dict] (with RETURN: keys = aliases or colN; without RETURN: keys = pattern variables plus _paths) |
Connection.schema() |
dict |
Connection.graph_types() |
list[dict] |
Connection.node_count / Connection.edge_count |
int |
Connection is not thread-safe across Python threads (PyO3 unsendable).
License
MIT. See LICENSE in the source repository.
Links
Release files for frogql 0.5.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| frogql-0.5.7.tar.gz | 581.8 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| frogql-0.5.7-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| frogql-0.5.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| frogql-0.5.7-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| frogql-0.5.7-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
| frogql-0.5.7-cp38-abi3-macosx_10_12_x86_64.whl | CPython 3.8 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 7.8 MB
Release files / frogql-0.5.7.tar.gz
| Download URL | frogql-0.5.7.tar.gz |
|---|---|
| Size | 581.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c6f678406b07a4945715ceac0305a0edd1b49b67f7e39f43e2a23bde5e19d18
|
|
BLAKE2b-256 checksum How to use checksums |
1dd95f2fc475dc8f78b5e4b1fb07d59178b4dbc9ad140ce37284a1e90b4a2c06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / frogql-0.5.7-cp38-abi3-win_amd64.whl
| Download URL | frogql-0.5.7-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
236bc80b1745c675d5d5a31368369bc0cbe23171190dd0d0da2960d7df0e47eb
|
|
BLAKE2b-256 checksum How to use checksums |
8e4c8377603421edcef7969ef753a2d2b66e07e86e03fd57b2132fc91a08fc3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / frogql-0.5.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | frogql-0.5.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
8d7e9618851cb3677634c2f76afac9c8d8ae990f0dd1dcd7f75ba11b5efa566d
|
|
BLAKE2b-256 checksum How to use checksums |
54f290def920a62da2487f5c32d90f7889f29c6f1e127cf31676bcb005063e0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / frogql-0.5.7-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | frogql-0.5.7-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
71afd18c70f39d05496ad188a43ed11c00ddbe3a9aaf321871b9df9d51e52a35
|
|
BLAKE2b-256 checksum How to use checksums |
139b7f8379cebb14c3225e51e427c2d734eb71f0dedd2e3862b34bdab0e27246
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / frogql-0.5.7-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | frogql-0.5.7-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
789fedaf44441c31ad69b7b251f682a08a190fa7c16bf460a4d3eeaadc9664a9
|
|
BLAKE2b-256 checksum How to use checksums |
0d9bab10195f5df166d11e780604371d7aae4f4cab86a1089252a03693625dd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|
Release files / frogql-0.5.7-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | frogql-0.5.7-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
9964b88cb5790bbf0b7a45f3ce948f0a6dec9b909f66eb61e1404e321c6a3b0e
|
|
BLAKE2b-256 checksum How to use checksums |
92a7286f3afc93b5be256869af0aa0cde904585617e7243450e6bf9fea86371a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
maturin/1.15.0
|