Giter Site home page Giter Site logo

py2orientdb's Introduction

py2orientdb

This is a work in progress. It will be a very simple client for interacting with OrientDB from Python 2.7, using OrientDB's REST interface with Python's requests library. The main goal is to create a client that does not require other libraries like Tinkerpop, and which enables a user who is familiar with SQL to create and query an OrientDB graph easily.

Goals

The goals for this project are to create a client that:

  • does not require a complex software stack, such as Tinkerpop (which is great, but may not always be available).
  • supports the entire SQL-like language that's built into OrientDB.
  • makes graph operations relatively simple, without requiring external libraries or special configuration.
  • fills-in gaps in functionality of OrientDB that SQL (and other) users are used to having. For example, lack of a cursor object for pagine through results; lack of an equivalent to SQL's "INSERT IGNORE" query.
  • makes it painless to import graphs in common formats.
  • supports and encourages creation of classes in definitions of graphs.
  • supports optimization of indices from within the client.

Afte we've got SQL working, we'll start working on suport for Gremlin.

Usage

Import py2orientdb and create an OrientDBConnection object:

import py2orientdb

DATABASE = 'GratefulDeadConcerts'
PASSWORD = 'MY_SUPER_SECRET_PASSWORD'
USER = 'root'
SERVER = 'http://localhost'
PORT = 2480

orient_connection = py2orientdb.OrientDBConnection(
    orientdb_address=SERVER, orientdb_port=PORT,
    user=USER, password=PASSWORD, database=DATABASE)

Then use the OrientDBConnection methods to query the database:

for i in orient_connection.select_from('v', "type = 'artist'"):
    document = orient_connection.get_document(i['@rid'])
    print document

To do list

  • Unit testing
  • Sphinx documentation
  • Error handling with more informative exceptions
  • Extra authentication for database-level operations (e.g. creating a database, listing databases, etc).

Notes

If you look at the main method of py2orientdb.py, you'll see that I've imported a file called global_config.py, which does nothing but contain the password, server address, and other configuration information that's needed to construct the OrientDBConnection object.

py2orientdb's People

Contributors

nszernst avatar zacernst 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.