Skip to main content

GraphCast suthing logo

A framework for transforming tabular (CSV, SQL) and hierarchical data (JSON, XML) into property graphs and ingesting them into graph databases (ArangoDB, Neo4j).

Python License: BSL pre-commit PyPI version DOI

Core Concepts

Property Graphs

GraphCast works with property graphs, which consist of:

  • Vertices: Nodes with properties and optional unique identifiers
  • Edges: Relationships between vertices with their own properties
  • Properties: Both vertices and edges may have properties

Schema

The Schema defines how your data should be transformed into a graph and contains:

  • Vertex Definitions: Specify vertex types, their properties, and unique identifiers
  • Edge Definitions: Define relationships between vertices and their properties
  • Resource Mapping: describe how data sources map to vertices and edges
  • Transforms: Modify data during the casting process

Resources

Resources are your data sources that can be:

  • Table-like: CSV files, database tables
  • JSON-like: JSON files, nested data structures

Features

  • Graph Transformation Meta-language: A powerful declarative language to describe how your data becomes a property graph:
    • Define vertex and edge structures
    • Set compound indexes for vertices and edges
    • Use blank vertices for complex relationships
    • Specify edge constraints and properties
    • Apply advanced filtering and transformations
  • Parallel processing: Use as many cores as you have
  • Database support: Ingest into ArangoDB and Neo4j using the same API (database agnostic)

Documentation

Full documentation is available at: growgraph.github.io/graphcast

Installation

pip install graphcast

Usage Examples

Simple ingest

from suthing import ConfigFactory, FileHandle

from graphcast import Schema, Caster, Patterns


schema = Schema.from_dict(FileHandle.load("schema.yaml"))

conn_conf = ConfigFactory.create_config({
        "protocol": "http",
        "hostname": "localhost",
        "port": 8535,
        "username": "root",
        "password": "123",
        "database": "_system",
}
)

patterns = Patterns.from_dict(
    {
        "patterns": {
            "work": {"regex": "\Sjson$"},
        }
    }
)

schema.fetch_resource()

caster = Caster(
    schema,
)

caster.ingest_files(
    path="./data",
    conn_conf=conn_conf,
    patterns=patterns,
)

Development

To install requirements

git clone git@github.com:growgraph/graphcast.git && cd graphcast
uv sync --dev

Tests

Test databases

Spin up Arango from arango docker folder by

docker-compose --env-file .env up arango

and Neo4j from neo4j docker folder by

docker-compose --env-file .env up neo4j

To run unit tests

pytest test

Requirements

  • Python 3.11+
  • python-arango

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Metadata

Release files for graphcast 0.14.2

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

Source distribution (sdist)

Source distribution for graphcast 0.14.2
File Size Uploaded Provenance Actions
graphcast-0.14.2.tar.gz 64.5 kB Without provenance Details for graphcast-0.14.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for graphcast 0.14.2
File Interpreter ABI Platform Actions
graphcast-0.14.2-py3-none-any.whl Python 3 none any Details for graphcast-0.14.2-py3-none-any.whl

Total release size: 149.6 kB

Release files / graphcast-0.14.2.tar.gz

Download URL graphcast-0.14.2.tar.gz
Size 64.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0b24be0d3f509c26ac10d229add699ffc50fea69ad1d57dbd3c453cf89750972
BLAKE2b-256 checksum
How to use checksums
e19ee150c93a52dbe94707d3298a4c89d8778afccf619e4861763f0453fb72c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.3

Release files / graphcast-0.14.2-py3-none-any.whl

Download URL graphcast-0.14.2-py3-none-any.whl
Size 85.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca0a36f792d365aa5fc23fbdb14fead1555d2b16113621aa683ac38db790ea31
BLAKE2b-256 checksum
How to use checksums
ef08e2146cf66501010758c552cea25a4556651dc17a53fefd654bb8c60ca9e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.3

Security for graphcast 0.14.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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