Giter Club home page Giter Club logo

neoalchemy's Introduction

NeoAlchemy

Docs for 0.8.0b Latest Build Status Codecov.io Report

NeoAlchemy is a SqlAlchemy-like tool for working with the Neo4J graph database in Python. It is intended to be very easy to use, and intuitively familiar to anyone who has used SqlAlchemy and/or the Cypher Query Language.

NeoAlchemy is built on top of the Neo4J Bolt driver and only supports Neo4J 3.0+ connected over the Bolt protocol. It supports Python 2.7 and 3.3+.

Getting Started

NeoAlchemy is available on PyPI, so it can be installed normally using pip install neoalchemy. NeoAlchemy is built on top of the official Neo4J Python driver. If you install from PyPI, this will automatically be installed alongside it. You can also install the dependencies using pip install -r requirements.txt.

Questions, support requests, comments, and contributions should be directed to GitHub accordingly.

Low-Level QueryBuilder API

import uuid

from neoalchemy import Create, Node, Property, Graph
from neoalchemy.validators import UUID

graph = Graph()

person = Node('Person',  # primary label
    uuid=Property(unique=True, type=UUID, default=uuid.uuid4),
    real_name=Property(indexed=True),
    screen_name=Property(indexed=True, type=str.lower),
    age=Property(type=int)
)

# Emit schema-generating DDL
graph.schema.create(person)

person.real_name = 'Alison'
person.screen_name = 'Ali42'
person.age = 29
create = Create(person)

graph.query(create, **create.params)

Learn more about the QueryBuilder API.

High-Level Schema OGM

import uuid

from neoalchemy import OGMBase, Property, Graph
from neoalchemy.validators import UUID

class Person(OGMBase):
    graph = Graph()

    uuid = Property(unique=True, type=UUID, default=uuid.uuid4)
    real_name = Property(indexed=True)
    screen_name = Property(indexed=True, type=str.lower)
    age = Property(type=int)

# Cypher schema generation emitted automatically
# No user action required

Person(real_name='Alison', screen_name='Ali42', age=29).create()

Learn more about the Schema OGM.

neoalchemy's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.