Skip to main content

froGQL — embedded GQL graph database with ISO GQL path patterns (Rust core, Python bindings)

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frogql-0.2.5.tar.gz (332.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

frogql-0.2.5-cp38-abi3-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.8+Windows x86-64

frogql-0.2.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ x86-64

frogql-0.2.5-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

frogql-0.2.5-cp38-abi3-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

frogql-0.2.5-cp38-abi3-macosx_10_12_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file frogql-0.2.5.tar.gz.

File metadata

  • Download URL: frogql-0.2.5.tar.gz
  • Upload date:
  • Size: 332.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.0

File hashes

Hashes for frogql-0.2.5.tar.gz
Algorithm Hash digest
SHA256 9ca39ef090d258bc607f5ceaa3ab11a5a9c8865cbfec2f0b0c2d6eb596002f2f
MD5 b2c850096c9fa4c61ef50e7f22d1f2db
BLAKE2b-256 83c40668a9f68a5f8155e9ebc431288e4f5056af2c296b1beb17e339bc6298c9

See more details on using hashes here.

File details

Details for the file frogql-0.2.5-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: frogql-0.2.5-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.14.0

File hashes

Hashes for frogql-0.2.5-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 b3ef8453da3aeb803e54d139bd92688f59a0f4315d7a627b6a74f0d28d9c65df
MD5 7ba8385b6e0eb3da48373a4d5bec4631
BLAKE2b-256 9d3d8b0e93b8efc559d6d698107a1cc6b6c82c27bafb7dc5aa4076b58bb00d5e

See more details on using hashes here.

File details

Details for the file frogql-0.2.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for frogql-0.2.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f2a99fc83ddf50718c09c5f5893baec32536b5c328f8c2def818132d0280a905
MD5 6beb348f5336b566d99bbe057fbb4364
BLAKE2b-256 509d266df099102d9aa127031d20e0c673bbf505db011ccf57f3f369107d4248

See more details on using hashes here.

File details

Details for the file frogql-0.2.5-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for frogql-0.2.5-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fb266bb147de59eac49353d74f9047e461203f5bb118cf4882a0db0c69ea9d23
MD5 2a8f42a3b4e1a8da823bb50e96a37134
BLAKE2b-256 f62a6f8dff1f78cfe7ace7b94c7ec40c5962b31fdd5c4966e3d9391bcbbe4a2f

See more details on using hashes here.

File details

Details for the file frogql-0.2.5-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for frogql-0.2.5-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ec7b36ad1f8a48f2e69f9f1ca1039df42ec101e18686bb4c1aa3fdc4899abbfc
MD5 ef24b040aa8e86e5dd61d3f4a1ce0ce0
BLAKE2b-256 374cdc9feb4fd5752f1b09e8b20a6dabd6f12d7ed7e606b2f434b85fd050f174

See more details on using hashes here.

File details

Details for the file frogql-0.2.5-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for frogql-0.2.5-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 05a4402430e6d91a31b5237e47206d958578ebb616bd7130679634762f9308e7
MD5 ac4a0312f5c3372f831ea6f0f2593e85
BLAKE2b-256 1e6674d5bfbee1fdd435e78d1b7995922e6e22c688635bcf12484a36bcff6e20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page