pytigergraph/ pyTigerGraph Overview
Last Updated: October 20, 2018Connecting your Python ecosystem to the TigerGraph database.
pyTigerGraph Overview
pyTigerGraph is the official Python SDK for TigerGraph. It provides a comprehensive suite of tools to manage schemas, execute queries, and integrate with data science workflows directly from Python.
1. Installation
The package is available on PyPI and can be installed via pip:
bashterminal# Core functionality only pip install pytigergraph # Full GDS support (includes ML utilities) pip install "pytigergraph[gds]"
2. Establishing a Connection
To connect, you need the hostname of your cluster and a graph name. If authentication is enabled, you also need a secret.
For On-Premises / Local
pythonterminalimport pyTigerGraph as tg conn = tg.TigerGraphConnection( host="http://localhost", graphname="MyGraph", username="tigergraph", password="password" ) conn.getToken(conn.createSecret())
For TigerGraph Cloud
Cloud instances always require a secret and automatically handle token generation in newer versions.
pythonterminalconn = tg.TigerGraphConnection( host="https://my-org.i.tgcloud.io", graphname="MyGraph", gsqlSecret="your-secret-here" ) conn.getToken("your-secret-here")
3. Why Use pyTigerGraph?
- Unified Interface: Combines REST API calls and GSQL shell commands into a single Python object.
- Data Science Ready: Seamlessly converts graph results into Pandas DataFrames.
- DevOps Automation: Programmatically create graphs, update schemas, and manage users.
[!TIP] Use
AsyncTigerGraphConnectionfor high-concurrency applications where you need to execute multiple non-blocking queries simultaneously.