NebulaGraph Python Client  release-3.8
SessionPool Class Reference
+ Inheritance diagram for SessionPool:
+ Collaboration diagram for SessionPool:

Public Member Functions

def __init__ (self, username, password, space_name, addresses)
 
def __del__ (self)
 
def init (self, Optional[SessionPoolConfig] configs=None, Optional[SSL_config] ssl_configs=None)
 
def ping (self, address)
 
def execute (self, stmt)
 
def execute_parameter (self, stmt, params)
 
def execute_json (self, stmt)
 
def execute_json_with_parameter (self, stmt, params)
 
def close (self)
 
def get_ok_servers_num (self)
 
def update_servers_status (self)
 
def ping_sessions (self)
 
- Public Member Functions inherited from BaseExecutor
ResultSet execute_parameter (self, str stmt, Optional[Dict[str, Any]] params)
 
bytes execute_json_with_parameter (self, str stmt, Optional[Dict[str, Any]] params)
 
ResultSet execute (self, str stmt)
 
bytes execute_json (self, str stmt)
 
def execute_py (self, str stmt, Optional[Dict[str, Any]] params=None)
 

Static Public Attributes

int S_OK = 0
 
int S_BAD = 1
 

Detailed Description

Definition at line 29 of file SessionPool.py.

Member Function Documentation

◆ close()

def close (   self)
log out all sessions and close all connections

:return: void

Definition at line 324 of file SessionPool.py.

+ Here is the caller graph for this function:

◆ execute()

def execute (   self,
  stmt 
)
execute the given query
Notice there are some limitations:
1. The query should not be a plain space switch statement, e.g. "USE test_space",
but queries like "use space xxx; match (v) return v" are accepted.
2. If the query contains statements like "USE <space name>", the space will be set to the
one in the pool config after the execution of the query.
3. The query should not change the user password nor drop a user.

:param stmt: the query string
:return: ResultSet

Definition at line 163 of file SessionPool.py.

+ Here is the caller graph for this function:

◆ execute_json()

def execute_json (   self,
  stmt 
)
execute statement and return the result as a JSON bytes
    Date and Datetime will be returned in UTC
    JSON struct:
    {
        "results": [
        {
            "columns": [],
            "data": [
            {
                "row": [
                "row-data"
                ],
                "meta": [
                "metadata"
                ]
            }
            ],
            "latencyInUs": 0,
            "spaceName": "",
            "planDesc ": {
            "planNodeDescs": [
                {
                "name": "",
                "id": 0,
                "outputVar": "",
                "description": {
                    "key": ""
                },
                "profiles": [
                    {
                    "rows": 1,
                    "execDurationInUs": 0,
                    "totalDurationInUs": 0,
                    "otherStats": {}
                    }
                ],
                "branchInfo": {
                    "isDoBranch": false,
                    "conditionNodeId": -1
                },
                "dependencies": []
                }
            ],
            "nodeIndexMap": {},
            "format": "",
            "optimize_time_in_us": 0
            },
            "comment ": ""
        }
        ],
        "errors": [
        {
            "code": 0,
            "message": ""
        }
        ]
    }
:param stmt: the ngql
:return: JSON bytes

Definition at line 222 of file SessionPool.py.

+ Here is the call graph for this function:

◆ execute_parameter()

def execute_parameter (   self,
  stmt,
  params 
)
execute statement

:param stmt: the query string
:param params: parameter map
:return: ResultSet

Definition at line 177 of file SessionPool.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_ok_servers_num()

def get_ok_servers_num (   self)
get the number of the ok servers

:return: int

Definition at line 339 of file SessionPool.py.

+ Here is the caller graph for this function:

◆ init()

def init (   self,
Optional[SessionPoolConfig]   configs = None,
Optional[SSL_config]   ssl_configs = None 
)
init the session pool

:param username: the username of the session
:param password: the password of the session
:param space_name: the space name of the session
:param addresses: the addresses of the servers
:param configs: the config of the pool

:return: if all addresses are valid, return True else return False.

Definition at line 75 of file SessionPool.py.

+ Here is the call graph for this function:

◆ ping()

def ping (   self,
  address 
)
check the server is ok

:param address: the server address want to connect
:return: True or False

Definition at line 130 of file SessionPool.py.

+ Here is the caller graph for this function:

◆ ping_sessions()

def ping_sessions (   self)
ping all sessions in the pool

Definition at line 367 of file SessionPool.py.

+ Here is the call graph for this function:

◆ update_servers_status()

def update_servers_status (   self)
update the servers' status

Definition at line 359 of file SessionPool.py.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: