GSQL client for TigerGraph
Project description
pyTigerDriver
Installation
install with pip:
pip install pyTigerDriver
Usage
Architecture: You can instatiate any Interface [GSQL or REST] in the pyTigerDriver seperately.
This flowchart illustrates the Classes:
graph LR
A[pyTigerDriver as tgCl] -- Gsql --> B((Gsql_Client))
A -- Rest --> C((Rest_Client))
B --> D{TigerGraph Database}
C --> D
Sample Code :
import pyTigerDriver as tg
tgCl = tg.Client(server_ip="127.0.0.1",username="tigergraph",password="tigergraph",version="3.0.5")
print("======================== SIMPLE RESTPP Queries ==================================")
print(tgCl.Rest.version())
print("============================== SIMPLE LS ===========================================")
res = tgCl.Gsql.query("ls")
print(res)
print("============================== LIST USERS ======================================")
res = tgCl.Gsql.query("SHOW USER")
print(res)
print("============================== Create a Secret ======================================")
res = tgCl.Gsql.query("USE GRAPH MyGraph") # change MyGraph --> to your graph
res = tgCl.Gsql.query("create secret mys") # Create a secret
print(res)
print("============================== Get Secrets ======================================")
res = tgCl.Gsql.get_secrets("MyGraph")
print(res)
print("=============================== Print Version =========================================")
print(tgCl.Gsql.version())
Code Linting And Unit Testing
Code Linting :
Linting using PEP8 Standards
user@box:~$ flake8 --exclude=venv* --ignore=E501 --statistics pyTigerDriver/restDriver.py
user@box:~$ flake8 --exclude=venv* --ignore=E501 --statistics pyTigerDriver/pyDriver.py
Running the tests :
run unit tests using pytest :
user@box:~$ pytest -v
CircleCi Work flow :
- create a folder named .circleci in the root of the repo
- within that folder create a file called config.yml containing the folloing flow :
version: 2.1
orbs:
python: circleci/python@0.2.1
jobs:
build-and-test:
executor: python/default
steps:
# Step 1: obtain repo from GitHub
- checkout
# Step 2: create virtual env and install dependencies
- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
# Step 3: run linter and tests
- run:
name: run tests
command: |
. venv/bin/activate
flake8 --exclude=venv* --ignore=E501 --statistics pyTigerDriver/pyDriver.py
flake8 --exclude=venv* --ignore=E501 --statistics pyTigerDriver/restDriver.py
pytest -v
workflows:
main:
jobs:
- build-and-test
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
pyTigerDriver-1.0.6.tar.gz
(10.2 kB
view hashes)
Built Distribution
Close
Hashes for pyTigerDriver-1.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cc82395e1a14f3eb5d8261e3636aa07568f5a86ab0a0a8a3abd22165bd7a09a |
|
MD5 | a0ed4d29f17222e147141a2040250dd0 |
|
BLAKE2b-256 | 71d89f192003380a5e381d15f6db3c7229481df3c3ec74d39b36c5b8e4668d8b |