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.0rc2.tar.gz (17.0 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.0rc2-cp38-abi3-win_amd64.whl (984.2 kB view details)

Uploaded CPython 3.8+Windows x86-64

frogql-0.2.0rc2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

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

frogql-0.2.0rc2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.17+ ARM64

frogql-0.2.0rc2-cp38-abi3-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

frogql-0.2.0rc2-cp38-abi3-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.8+macOS 10.12+ x86-64

File details

Details for the file frogql-0.2.0rc2.tar.gz.

File metadata

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

File hashes

Hashes for frogql-0.2.0rc2.tar.gz
Algorithm Hash digest
SHA256 e9a17b1ae97163209a0864ef241a63960c0d01e09c8e535f88fd949964f5502b
MD5 6bafaeee247db04963a5ad5a55668f3e
BLAKE2b-256 8f105a7ecc2de99bc2df2f18ae54f44cf8472e26749f2b00e63a510ed5cf4af5

See more details on using hashes here.

File details

Details for the file frogql-0.2.0rc2-cp38-abi3-win_amd64.whl.

File metadata

  • Download URL: frogql-0.2.0rc2-cp38-abi3-win_amd64.whl
  • Upload date:
  • Size: 984.2 kB
  • 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.0rc2-cp38-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2657f8c098eb83bb86e0da4a3fd07e2c2266cb04afb99ded93e8a18349e1c184
MD5 8cf4b22eacbfdaf71bf3c67d3ab1e1ee
BLAKE2b-256 3fb810d482da4b3cf4fb386ed4fa2274c08e0c3683f4aac0c0c6aa163c374fc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for frogql-0.2.0rc2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a6a698e3f2e15a8ce1bb0a260dea094399ac5cba3175b4a4342452a80649a78
MD5 cd770cd60d3dcd4956af84a41ff36892
BLAKE2b-256 fb6f0c27d7365bed39a520079021319f201781faf29286d75d394be93bc33e78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for frogql-0.2.0rc2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 d8ab37271a8af9c369b18ec8d5aa3b62d97c6bdc5163cc996b9e73a3eeb3f216
MD5 bc9f1b8dbb7faaec2ec19568283433e5
BLAKE2b-256 e6ac29449bb64fc0a527c9829dbf679e32f3e598ba25982ffdc2ccc9d1452d4c

See more details on using hashes here.

File details

Details for the file frogql-0.2.0rc2-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for frogql-0.2.0rc2-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8de45f2de2c9263158ecf1dc31a707f588a39ca500faad038ab2c141ca84d687
MD5 91236fcb226eedd3978e86815f02aa94
BLAKE2b-256 dcdbd02be961f391f59fc434420d12fd3a1f257f247da897aa00059a88dddb70

See more details on using hashes here.

File details

Details for the file frogql-0.2.0rc2-cp38-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for frogql-0.2.0rc2-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6ed65c5c364c956cefcebcef05f7eaa8e62deb204ebe4566d9054ff90e8bd159
MD5 f88b423f45577b4695eb6963d06ed28d
BLAKE2b-256 9bfa4a6fad67902195ad5a22717ebf5d6dea13a705ad3b957df099a2899efff5

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