Getting Started with Graph OLAP SDK
Tutorial
Getting Started with Graph OLAP SDK
Install the SDK, connect to the platform, and run your first query
What You'll Learn
- Installation - Install graph-olap SDK via pip
- Connection - Connect to the Graph OLAP platform
- First Query - Execute your first Cypher query
- Quick Start - Use the quick_start() convenience method
1
Installation
Install the SDK package
# Install the SDK# pip install graph-olap
# Verify installationimport graph_olapprint(f"SDK Version: {graph_olap.__version__}")
2
Connecting to the Platform
Create a client and authenticate
# Cell 1 — ParametersUSERNAME = "_FILL_ME_IN_" # Set your email before running# Cell 2 — Connectfrom graph_olap import GraphOLAPClientclient = GraphOLAPClient(username=USERNAME)
# Cell 3 — Provisionfrom notebook_setup import provisionpersonas, conn = provision(USERNAME)analyst = personas["analyst"]admin = personas["admin"]ops = personas["ops"]client = analyst
print(f"Connected! Graph has {conn.query_scalar('MATCH (n) RETURN count(n)')} nodes.")
3
Your First Query
Run a Cypher query and inspect the results
# Query the your customer graphresult = conn.query("MATCH (c:Customer) RETURN c.id AS name, c.bk_sectr AS sector LIMIT 5")
result.show()
4
Using Quick Start
One-line setup with quick_start()
from graph_olap_schemas import WrapperType
# quick_start() is a convenience method that combines mapping lookup + instance creation + connect# conn = client.quick_start(mapping_id=mapping.id, wrapper_type=WrapperType.RYUGRAPH)
# Since we're already connected, let's count nodestotal = conn.query_scalar("MATCH (n) RETURN count(n)")print(f"Total nodes in graph: {total}")Key Takeaways
- SDK installed via
pip install graph-olap - Use
GraphOLAPClient.from_env()to connect to the control plane - Use
client.mappings.list()/client.mappings.create()to manage graph schemas - Use
client.instances.create_and_wait()to deploy a queryable graph database - Use
client.instances.connect()to get a connection for running Cypher queries quick_start(mapping_id, wrapper_type)combines instance creation and connection in one call