Skip to main content

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=100) 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.4.1

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

Source distribution (sdist)

Source distribution for frogql 0.4.1
File Size Uploaded
frogql-0.4.1.tar.gz 450.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for frogql 0.4.1
File
frogql-0.4.1-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
frogql-0.4.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 abi3 Linux glibc 2.17+ x86-64 Details
frogql-0.4.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
frogql-0.4.1-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
frogql-0.4.1-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details

Total release size: 7.1 MB

Release files / frogql-0.4.1.tar.gz

Download URL frogql-0.4.1.tar.gz
Size 450.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8c6c59862575bcbbfdaeb01cc0820edf3e3ec95bda2363df313af0bc19f775b5
BLAKE2b-256 checksum
How to use checksums
716cef4c410768d012a22e750e3e3eb30189702c2dcb18e73f8041d14641af7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / frogql-0.4.1-cp38-abi3-win_amd64.whl

Download URL frogql-0.4.1-cp38-abi3-win_amd64.whl
Size 1.3 MB
Tags CPython 3.8 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
579c4b6d74aa3db47d5be3e5717d4898171a91d7bfc43b2d548ceb83084c50ac
BLAKE2b-256 checksum
How to use checksums
c7b8c27ecd44669d9a4f5a92315c51e1af2a6c95077257689371cd4f7df9ba4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / frogql-0.4.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL frogql-0.4.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.4 MB
Tags CPython 3.8 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
bf21c61dc3a435d554ba26ee89f85bd23a00fc771e1cd7951fde099960ef867e
BLAKE2b-256 checksum
How to use checksums
ea924defb879520a8d31f5c0845f2d3f61ae71f1f5b0cc7259be1da97426b282
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / frogql-0.4.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL frogql-0.4.1-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.4 MB
Tags CPython 3.8 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
5b105e887fe147bcff07d5fe37044ef9598f621bc08ca34cddc6f862ed5cd8fc
BLAKE2b-256 checksum
How to use checksums
95d5e28b15046382b60ecdc0dc49dfb180603c082fc2f11a0355c7f0efded9e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / frogql-0.4.1-cp38-abi3-macosx_11_0_arm64.whl

Download URL frogql-0.4.1-cp38-abi3-macosx_11_0_arm64.whl
Size 1.3 MB
Tags CPython 3.8 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0fdf468a2e315756b15c98b3a3a13c78d4ee0ac9f39e932cc76b4d0502a72afc
BLAKE2b-256 checksum
How to use checksums
7a83628c5f0bcaf58db31f30399c9edb56b6204f290592d544e8ce458df98056
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / frogql-0.4.1-cp38-abi3-macosx_10_12_x86_64.whl

Download URL frogql-0.4.1-cp38-abi3-macosx_10_12_x86_64.whl
Size 1.3 MB
Tags CPython 3.8 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
58f5654076c212a53c645be6205cf6570b1a6cadf64067ab2ef03b9e2a14cc7b
BLAKE2b-256 checksum
How to use checksums
a7ac2afd1683502ed37bde827c067b73406c0150d00fb7b5ea5ef6a3247f14a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0
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