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=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.

Release files for frogql 0.5.8

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.5.8
File Size Uploaded
frogql-0.5.8.tar.gz 1.2 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for frogql 0.5.8
File
frogql-0.5.8-cp38-abi3-win_amd64.whl CPython 3.8 abi3 Windows x86-64 Details
frogql-0.5.8-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.8-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.8 abi3 Linux glibc 2.17+ ARM64 Details
frogql-0.5.8-cp38-abi3-macosx_11_0_arm64.whl CPython 3.8 abi3 macOS 11.0+ ARM64 Details
frogql-0.5.8-cp38-abi3-macosx_10_12_x86_64.whl CPython 3.8 abi3 macOS 10.12+ x86-64 Details

Total release size: 8.4 MB

Release files / frogql-0.5.8.tar.gz

Download URL frogql-0.5.8.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
9e27674ee983606abf9356b964e5fe8402d625b8ee8af933b15ea4f93e5f4bd7
BLAKE2b-256 checksum
How to use checksums
7200bca6809597e1ff4da2f46ef35ca24d9d92132cb9912137944d3f2c946f2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

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

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

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

Download URL frogql-0.5.8-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
e56e67fdb44395fceba2282bd1fed682412ae0313950cca213e435647477a962
BLAKE2b-256 checksum
How to use checksums
9bf6033f4ceca303161e6df73d1c447d00ce059ab99d98def9e9b3b4950935d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

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

Download URL frogql-0.5.8-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
e426332aa0bbbc0e42b7e58e7b9bc9d86d47ed4e5822b41cd588a472aa9ccf2e
BLAKE2b-256 checksum
How to use checksums
242cf8a6c28c177d60cb373e1cdf83b152afe8b30dca6dd38532a8a312d26cdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

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

Download URL frogql-0.5.8-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
6f8276be3e76f46bd804c15a0084e6bfd61adc6f45116ff320b743d0f77dcc27
BLAKE2b-256 checksum
How to use checksums
e711709c5cad1a2db38e8183ab5f5593ec2970eafc650601c9fe61a14f385ca4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

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

Download URL frogql-0.5.8-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
245b0393098359d1f87c916a482f2b4915bd6aa9fb930b654ecebcad66d1c487
BLAKE2b-256 checksum
How to use checksums
232fe62265dec770788da75ebb69dadd065ecc236da7497033d266793085eb90
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