Registry / database / pydgraph

pydgraph

JSON →
library25.2.0pypypi✓ verified 83d ago

Official Python client for Dgraph, a distributed graph database. Version 25.2.0 supports Dgraph v25 API, requires Python >=3.9, and uses gRPC for communication. Release cadence is approximately quarterly.

pip install pydgraph
INSTALL
IMPORT
SIG · PYDGRAPH
P
pydgraph
databasepythonv25.2.0
Install
3.0s avg
Import
—
Disk
37MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v25.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 40.4MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 3.0s · import 0.000s · 38MB
37MB installed
● package 37MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DgraphClient
✓ from pydgraph import DgraphClient
✗ from pydgraph import stub
DgraphClientStub
✓ from pydgraph import DgraphClientStub
Txn
✓ from pydgraph import Txn

Connect to a local Dgraph instance, set schema, query data.

import pydgraph # Create a client stub client_stub = pydgraph.DgraphClientStub('localhost:9080') # Create a client client = pydgraph.DgraphClient(client_stub) # Set schema schema = 'name: string @index(exact) .' op = pydgraph.Operation(schema=schema) client.alter(op) # Create a transaction and run a query txn = client.txn(read_only=True) res = txn.query('{"me": function(func: eq(name, "Alice")) { name }}') print(res.json) txn.discard() # Close the stub client_stub.close()
Debug
Known issues
gotchaUsing `from pydgraph import DgraphClientStub` is incorrect; the correct import is `from pydgraph import DgraphClientStub` (same) but note that `DgraphClientStub` is actually imported as `dgraph_client_stub` in some older docs. Actually the correct symbol is `DgraphClientStub` available directly.
fix
Use `from pydgraph import DgraphClientStub` for the stub class.
affects: all
gotchaTransactions must be either committed or discarded; forgetting to discard a read-only transaction can lead to resource leaks.
fix
Always call `txn.discard()` in a finally block or use context manager (since v25.1.0).
affects: all
gotchaThe `from_cloud` function (deprecated in v23.0.0) may not work with newer Dgraph Cloud endpoints; use `from_cloud` with caution.
fix
Use `DgraphClientStub(api_endpoint)` directly or check cloud documentation.
affects: >=23.0.0
breakingv25.0.0 updated to use Dgraph v25 API, which is incompatible with older Dgraph servers. Replaced RPC calls may cause connection failures.
fix
Upgrade Dgraph server to v25.x or use an older pydgraph version (e.g., 24.3.0) with Dgraph v24.
affects: >=25.0.0
Upgrade
Version history
25.2.0latest on PyPI · released Feb 25, 2026
Audit
Dependencies
grpciorequiredgRPC communication with Dgraph server
protobufrequiredProtocol Buffers for data serialization
Agent activity
24 hits · last 30 days
node
22
Resources
pydgraph — pip install pydgraph · libregistry