Registry / database / nebula3-python

nebula3-python

JSON →
library3.8.3pypypi✓ verified 84d ago

Python client library for NebulaGraph v3.x graph database. Current version 3.8.3 on PyPI, but the 5.x series (v5.2.2) is the new generation with async-native client, connection/session pools, and ORM. The v3.x line is stable and still maintained for legacy NebulaGraph v3 deployments.

pip install nebula3-python
INSTALL
IMPORT
SIG · NEBULA3-PYTHON
N
nebula3-python
databasepythonv3.8.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

ConnectionPool
from nebula3.gclient.net import ConnectionPool
from nebula3_python import ConnectionPool
The package is imported as 'nebula3' not 'nebula3_python'
Session
from nebula3.gclient.net import Session
from nebula3_python import Session
Session is in the gclient.net submodule
AuthResult
from nebula3.common import AuthResult
from nebula3_python.common import AuthResult
Correct module path uses 'common' not 'gclient'
SSLContext
from nebula3.gclient.net import SSLContext
from nebula3.settings import SSLContext
SSL support is only available in v3.8.2+ and imported from gclient.net

Initialize a connection pool, get a session, execute a simple query, and release resources.

import os from nebula3.gclient.net import ConnectionPool from nebula3.Config import Config config = Config() config.max_connection_pool_size = 10 pool = ConnectionPool() addresses = [("127.0.0.1", 9669)] user = os.environ.get('NEBULA_USER', 'root') password = os.environ.get('NEBULA_PASSWORD', 'nebula') if not pool.init(addresses, config): raise Exception("Connection pool initialization failed") session = pool.get_session(user, password) result = session.execute('SHOW SPACES;') print(result) session.release() pool.close()
Debug
Known issues
breakingNebulaGraph v5.x is not compatible with nebula3-python. Use nebula3-python>=5.0.0 for v5.x and nebula3-python<5 for v3.x.
fix
Match client major version to server major version: v3 client for v3 server, v5 client for v5 server.
affects: >=5.0.0 (client) and v3.x client vs v5 server
gotchaThe 'SessionPool' class was introduced in v3.8.0 but is only stable when using TLS (v3.8.2+). Without TLS, connections may leak. Use 'ConnectionPool' with explicit session management as a safe fallback.
fix
Upgrade to v3.8.2 or later, or avoid SessionPool and manage sessions manually with ConnectionPool.
affects: 3.8.0 - 3.8.1
gotchaThe 'Node.tags()' method returns a list of tag names, not a list of tag values. This changed in v3.8.0; prior versions returned tag values. If you depend on tag values, use 'Node.properties()' or 'Node.values()'.
fix
Use 'node.properties()' or 'node.values()' to get actual data instead of tag names.
affects: 3.8.0+
deprecatedThe 'nebula3.gclient.net.Session.execute_json()' method is deprecated in v3.8.3. Use 'session.execute()' and parse the ResultSet instead.
fix
Replace session.execute_json(query) with session.execute(query) and handle ResultSet as_dict() or as_primitive().
affects: 3.8.3
Errors
Common errors & fixes
nebula3.gclient.net.ConnectionPool.init() takes 2 positional arguments but 3 were given
Passing config as a separate argument instead of as keyword argument.
fix
Use: pool.init(addresses, config) where config is a Config object, not a dict.
AttributeError: module 'nebula3' has no attribute 'ConnectionPool'
Incorrect import path. This is typically because one uses 'import nebula3' instead of 'from nebula3.gclient.net import ConnectionPool'.
fix
Use: from nebula3.gclient.net import ConnectionPool
nebula3.common.AuthError: Authentication failed
Incorrect username or password, or using root with a password when no password is set.
fix
Set NEBULA_USER and NEBULA_PASSWORD environment variables, or use default (root/nebula). Verify credentials in NebulaGraph.
Upgrade
Version history
3.8.3latest on PyPI · released Oct 22, 2024
Audit
Dependencies
httpxoptionalUsed for async HTTP/2 communication with NebulaGraph v5.x
pydanticoptionalRequired for ORM models (v5.x only)
Agent activity
21 hits · last 30 days
node
20
Resources
nebula3-python — pip install nebula3-python · libregistry