NebulaGraph Python Client  release-3.4
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, configs)
 
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)
 

Static Public Attributes

int S_OK = 0
 
int S_BAD = 1
 

Detailed Description

Definition at line 26 of file SessionPool.py.

Member Function Documentation

◆ close()

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

:return: void

Definition at line 266 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 136 of file SessionPool.py.

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

◆ execute_json()

def execute_json (   self,
  stmt 
)
execute statement and return the result as a JSON string
    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 string

Definition at line 179 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 150 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 281 of file SessionPool.py.

+ Here is the caller graph for this function:

◆ init()

def init (   self,
  configs 
)
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 72 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 116 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 309 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 301 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: