Skip to main content

Licensed Kafka to Neo4j Graph Ingestion Engine for turn-key graph building

Project description

KafkaGraph

Licensed Kafka to Neo4j ingestion SDK.

Overview

KafkaGraph is a production-grade SDK that ingests events from Kafka and materializes them into a Neo4j graph. It supports single API key authentication and pluggable mapping modes, and is suitable for embedding into customer systems.

Problem It Solves

  • Converts high-volume Kafka event streams into navigable Neo4j graph structures without bespoke pipelines.
  • Provides a consistent ingestion engine with batching, error safety, and transactional commits.
  • Enforces enterprise-grade licensing, rate limits, and partition caps to align with commercial agreements.
  • Offers simple-to-extend mapping modes to transform JSON events to nodes and relationships rapidly.

Features

  • License enforcement with signed license files and machine fingerprint binding.
  • API key mode for testing with default deterministic keys.
  • Feature gating: simple, autograph, sequence mappers.
  • Batching for efficient writes and offset commits.
  • Partition monitoring to enforce per-topic and total caps.
  • Extensible dispatcher for new mapping modes and features.

Install

pip install .

Usage

from kafkagraph import KafkaGraph

kg = KafkaGraph(
    license_file="license.json",
    kafka_config={"brokers": ["localhost:9092"], "group_id": "kafkagraph"},
    neo4j_config={"uri": "bolt://localhost:7687", "user": "neo4j", "password": "pass"},
    topics_config_path="topics.yaml",
    batch_size=500
)

kg.start()

Topics Configuration

Provide a topics.yaml that declares how events should be mapped:

orders:
  mode: simple
  nodes:
    order:
      label: Order
      id: orderId
    customer:
      label: Customer
      id: customerId
  relationships:
    - type: PLACED_BY
      from: order
      to: customer
      properties: [createdAt, source]

profiles:
  mode: sequence
  base:
    label: User
    id: userId
  sequences:
    - field: devices
      label: Device
      id_field: deviceId
      type: OWNS
      properties: [model, os]

API Key Authentication

Set a single API key via environment:

Environment:

export KAFKAGRAPH_API_KEY="your_api_key"

Use with API key:

from kafkagraph import KafkaGraph

kg = KafkaGraph(
    api_key="your_api_key",  # must match KAFKAGRAPH_API_KEY
    kafka_config={"brokers": ["localhost:9092"], "group_id": "kafkagraph"},
    neo4j_config={"uri": "bolt://localhost:7687", "user": "neo4j", "password": "pass"},
    topics_config_path="topics.yaml",
    batch_size=500
)

kg.start()

If the environment variable is not set or the provided key does not match, an error is raised.

Neo4j Write Semantics

  • Nodes are merged by label and id.
  • Relationships are merged by type and endpoints, then properties are set from each event batch.
  • Writes happen when batch_size is reached, followed by consumer offset commits.

Extensibility

  • Add new mapping modes under kafkagraph/mappers/ and extend core/dispatcher.py.
  • Adjust license limits and feature flags per enterprise tier in license manager classes.
  • Swap batching strategy (size/time) by modifying core/batcher.py.

Security

  • Do not hardcode private keys. PUBLIC_KEY_B64 must be provided securely in deployments.
  • API keys can be loaded via environment or file; rotate keys as needed.

Author

Siddhappa Birajdar
Software Developer @FirstCry.com | Ex-Founder & CEO @Punarvspace Inc | Entrepreneurship | Python, Django, Flask, FastAPI, AI/ML, Generative AI, Quantum Computing, Blockchain | AWS Certified Solution Architect Associate
LinkedIn: https://www.linkedin.com/in/siddhappabirajdar

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

kafkagraph-0.1.3.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

kafkagraph-0.1.3-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file kafkagraph-0.1.3.tar.gz.

File metadata

  • Download URL: kafkagraph-0.1.3.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for kafkagraph-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6230f7a40e222668e26cfa6c1a0743a6fab43d2ce9220cafed0f756bed109395
MD5 7850aa5f260f216bfe11d074ada0e0d5
BLAKE2b-256 95051f4c315172d31cc9e7d5a54d89ee4dc59589e69ea1a10b791d0809a27f46

See more details on using hashes here.

File details

Details for the file kafkagraph-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: kafkagraph-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for kafkagraph-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 74ac3c6a61ac5001996c13b67f7aa78066d41959c63e8816ef8a07efe6e9bde1
MD5 68d6c326ddf7c50d96a9feeb3f33bc95
BLAKE2b-256 fad6cc4c02e3a3246f32f9cccf038c5b31ab990ea86796c3fe03657c3064958d

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