Python interface to StellarDB
Project description
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)
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
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
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
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:
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:
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 daemon
Testing
On his way
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PyStellarDB-0.0.3.tar.gz
(24.9 kB
view hashes)
Built Distribution
Close
Hashes for PyStellarDB-0.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2807ad85137913e149faa17d419040ef81f600d7e8ba80bb5e93ba02e46498a4 |
|
MD5 | cc5b0d8b787e5ad0d9b2128585dce305 |
|
BLAKE2b-256 | b3c240de3d7a5f7b127e7df4bb16f48a2037f582f4bf47ea1d596082b91df6a3 |