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.4.tar.gz (20.1 MB 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.4-cp38-abi3-win_amd64.whl (1.1 MB view details)

Uploaded CPython 3.8+Windows x86-64

frogql-0.2.4-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.4-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.4-cp38-abi3-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

frogql-0.2.4-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.4.tar.gz.

File metadata

  • Download URL: frogql-0.2.4.tar.gz
  • Upload date:
  • Size: 20.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.13.3

File hashes

Hashes for frogql-0.2.4.tar.gz
Algorithm Hash digest
SHA256 c9a00a6a606b4a24145cf11b42ee9dd61136cdaf05f4d0832a5752a733f254e6
MD5 a7805cbc7f2670159e0c2c76537d0ed5
BLAKE2b-256 977ac0efc5459235e02d147a1f0a5e1cc0905bca3a361c8807f5a8c8c29b9df3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: frogql-0.2.4-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.13.3

File hashes

Hashes for frogql-0.2.4-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d86da7317808720f51ca60b663145e15ec4e9e42ed318f7eb86f221e9de7da4d
MD5 c66795441fded26c653b9b403c6ad95f
BLAKE2b-256 173a23222dd741eca1c9a0635951ff501bf4b2a94413ed2c4349fc0ccc809e37

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for frogql-0.2.4-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4a605c704b6906b7f1fb34561e3d9b50514b15fc608c06533d9e9a82ffd86454
MD5 37bf51d13c84e6a8ca18666b8a7b2d51
BLAKE2b-256 d603b77443d8f20af377093edc26bdd0e9b7fa8ed5852546ea72b9684950b547

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for frogql-0.2.4-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 a16aa7f049b2a5dce7f9d576a9dcfda154ab8493e3a0e8faf5f302d9a90fe078
MD5 7eaf8b0936d74e08185285ab56e6ff49
BLAKE2b-256 ac5f60d414095a9b1e599aaf7865b49ea26afc56fdd20740b551d12e6f19bc2c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for frogql-0.2.4-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 73bbc469d1649bd28820ca8499c39ccd69afc644cc6b311150b277f32f105861
MD5 11346bf06273ab241d8a610555f3c721
BLAKE2b-256 90277967b76221bea2c3af22e5d22c121e9526871b7bbeb91f20d8ccf5290227

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for frogql-0.2.4-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 63409dba306eff12a3a8ae34da896f7a7dac2b5c6a369cb422998f9f850ea816
MD5 41599af9d4650f37feec7c686ad57582
BLAKE2b-256 413448be40c8a8815e600d06c04e4ab8540824448edd4ddaea11b496bf3a90ad

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