Giter Club home page Giter Club logo

nebula-python's Introduction

nebula-python

star this repo fork this repo

This repository provides Nebula client API in Python.

The directory structure

|--nebula-python
    |
    |-- nebula                        // client code
    |   |-- Client.py                 // interfaces controlling nebula
    |   |-- ConnectionPool.py         // the connection pool that manages all the connections, users can specify the connection numbers and timeout when creating it
    |
    |-- common                        // the common data types
    |
    |-- graph                         // data types and client interfaces to interact with graphd
    |
    |-- meta                          // data types and client interfaces to interact with metad
    |
    |-- storage                       // data types and client interfaces to interact with storaged
    |
    |__ thrift                        // the socket implementation code
    |
    |-- examples
    |   |__ ClientExample.py          // the example code
    |
    |-- tests
    |   |__ test_client.py            // the test code
    |
    |-- setup.py                      // used to install or package
    |
    |-- README.md                     // the introduce of nebula-python
    |
    |__ LICENSES                      // license file

How to get nebula-python

Option One: cloning from GitHub

  • Cloning
git clone https://github.com/vesoft-inc/nebula-python.git
cd nebula-python
  • Install

python2

sudo python setup.py install

python3

sudo python3 setup.py install

Note that when installing via python3, the error message msg extras_require = {':python_version == "2.7"':['futures']} will appear. There is no such package under python3, just ignore this error.

When your environment cannot access pypi, you need to manually install the following packages.

  • django-import-export
  • future
  • six
  • httplib2
  • futures # python2.x is needed

Option Two: using pip

sudo pip install nebula-python

How to use nebula-python in your code

There are three major modules:

  • ConnectionPool.py
  • Client.py
  • ttypes.py

Please refer to the sample code on detail usage. If you want to run the sample code, please install prettytable via pip.

Steps to create a client

  • Step1: create a connection pool
    • The default connection number of the connection pool is two
    • The default timeout of connection is 1000ms
    • When the created clients exceed the number of connections in the connection pool, the clients that exceed the number of connections will enter the wait state, waiting for the previous clients to release before continuing
  • Step2: create a client through the connection pool
  • Step3: authenticate
  • Step4: execute/execute_query
  • Step5: return the client to pool and close pool

nebula-python's People

Contributors

laura-ding avatar amber1990zhang avatar dutor avatar darionyaphet avatar jievince avatar

Watchers

James Cloos 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.