Python client for Nebula Graph

pip install nebula-python==1.0.0-rc2-1



star this repo fork this repo

This repository provides Nebula client API in Python.

The directory structure

    |-- nebula                        // client code
    |   |--                 // interfaces controlling nebula
    |   |--         // 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
    |   |__          // the example code
    |-- tests
    |   |__            // the test code
    |--                      // used to install or package
    |--                     // the introduce of nebula-python
    |__ LICENSES                      // license file

How to get nebula-python

Option One: cloning from GitHub

  • Cloning
git clone
cd nebula-python
  • Install


sudo python install


sudo python3 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:


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