Metadata-Version: 2.1
Name: PyStellarDB
Version: 0.0.3
Summary: Python interface to StellarDB
Home-page: https://github.com/WarpCloud/PyStellarDB
Author: Zhiping Wang
Author-email: zhiping.wang@transwarp.io
License: Apache License, Version 2.0
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Database :: Front-Ends
Requires-Python: >=2.7
Provides-Extra: hive
Provides-Extra: sqlalchemy
Provides-Extra: presto
Provides-Extra: kerberos
Requires-Dist: future
Requires-Dist: python-dateutil
Requires-Dist: pyhive
Requires-Dist: sasl
Requires-Dist: thrift
Requires-Dist: thrift-sasl
Provides-Extra: hive
Requires-Dist: sasl (>=0.2.1); extra == 'hive'
Requires-Dist: thrift (>=0.10.0); extra == 'hive'
Requires-Dist: thrift-sasl (>=0.1.0); extra == 'hive'
Provides-Extra: kerberos
Requires-Dist: requests-kerberos (>=0.12.0); extra == 'kerberos'
Provides-Extra: presto
Requires-Dist: requests (>=1.0.0); extra == 'presto'
Provides-Extra: sqlalchemy
Requires-Dist: sqlalchemy (>=1.3.0); extra == 'sqlalchemy'

PyStellarDB
===========

PyStellarDB is a Python API for executing Transwarp Exetended OpenCypher(TEoC) and Hive query.
It is base on PyHive(https://github.com/dropbox/PyHive)

Usage
=====

PLAIN Mode (No security is configured)
---------------------------------------
.. code-block:: python

    from pystellardb import stellar_hive

    conn = stellar_hive.StellarConnection(host="localhost", port=10000, graph_name='pokemon')
    cur = conn.cursor()
    cur.execute('config query.lang cypher')
    cur.execute('use graph pokemon')
    cur.execute('match p = (a)-[f]->(b) return a,f,b limit 1')

    print cur.fetchall()


LDAP Mode
---------
.. code-block:: python

    from pystellardb import stellar_hive

    conn = stellar_hive.StellarConnection(host="localhost", port=10000, username='hive', password='123456', auth='LDAP', graph_name='pokemon')
    cur = conn.cursor()
    cur.execute('config query.lang cypher')
    cur.execute('use graph pokemon')
    cur.execute('match p = (a)-[f]->(b) return a,f,b limit 1')

    print cur.fetchall()


Kerberos Mode
-------------
.. code-block:: python

    from pystellardb import stellar_hive

    conn = stellar_hive.StellarConnection(host="localhost", port=10000, kerberos_service_name='hive', auth='KERBEROS', graph_name='pokemon')
    cur = conn.cursor()
    cur.execute('config query.lang cypher')
    cur.execute('use graph pokemon')
    cur.execute('match p = (a)-[f]->(b) return a,f,b limit 1')

    print cur.fetchall()


Execute Hive Query
------------------
.. code-block:: python

    from pystellardb import stellar_hive

    # If `graph_name` parameter is None, it will execute a Hive query and return data just as PyHive does
    conn = stellar_hive.StellarConnection(host="localhost", port=10000, database='default')
    cur = conn.cursor()
    cur.execute('SELECT * FROM default.abc limit 10')


Dependencies
============

Required:
------------

- Python 2.7+ / Python 3

System SASL
------------

Different systems require different packages to be installed to enable SASL support
in Impyla. Some examples of how to install the packages on different distributions
follow.

Ubuntu:

.. code-block:: bash

    apt-get install libsasl2-dev libsasl2-2 libsasl2-modules-gssapi-mit
    apt-get install python-dev gcc              #Update python and gcc if needed

RHEL/CentOS:

.. code-block:: bash

    yum install cyrus-sasl-md5 cyrus-sasl-plain cyrus-sasl-gssapi cyrus-sasl-devel
    yum install gcc-c++ python-devel.x86_64     #Update python and gcc if needed


Requirements
============

Install using

- ``pip install 'pystellardb[hive]'`` for the Hive interface.

PyHive works with

- For Hive: `HiveServer2 <https://cwiki.apache.org/confluence/display/Hive/Setting+up+HiveServer2>`_ daemon


Testing
=======

On his way

