|
from nebula3.Config import Config |
|
from nebula3.gclient.net import ConnectionPool |
|
from nebula3.mclient import MetaCache |
|
from nebula3.gclient.net import Connection |
|
from nebula3.graph import GraphService |
|
|
|
|
|
config = Config() |
|
config.max_connection_pool_size = 10 |
|
|
|
|
|
connection_pool = ConnectionPool() |
|
|
|
|
|
if not connection_pool.init([('127.0.0.1', 9669)], config): |
|
print("接続に失敗しました") |
|
exit(1) |
|
|
|
|
|
session = connection_pool.get_session('username', 'password') |
|
|
|
|
|
result_set = session.execute('SHOW SPACES') |
|
|
|
|
|
if not result_set.is_succeeded(): |
|
print(result_set.error_msg()) |
|
else: |
|
for result in result_set.rows(): |
|
print(result) |
|
|
|
|
|
session.release() |
|
|
|
|
|
connection_pool.close() |
|
|