ultipa.connection package

Submodules

ultipa.connection.clientInfo module

class ultipa.connection.clientInfo.ClientInfo(Rpcsclient: UltipaRpcsStub, Controlsclient: UltipaControlsStub, metadata: any, graphSetName: str, host: str)[source]

Bases: object

This class defines basic settings for the client end that establishes an Ultipa connection.

It stores information such as usage of RPCs, control features, host information, etc.

class ultipa.connection.clientInfo.GrpcClientInfo(host: str, username: str, password: str, crt: str, maxRecvSize: int = -1)[source]

Bases: object

This class defines settings for the client’s usage of gRPC when communicating with an Ultipa server.

Controlsclient: UltipaControlsStub
Rpcsclient: UltipaRpcsStub
getMetadata(graphSetName, timeZone, timeZoneOffset)[source]
host: str
password: str
username: str

ultipa.connection.clientType module

class ultipa.connection.clientType.ClientType[source]

Bases: object

This class defines the types of client.

Algo = 1
Default = 0
Leader = 3
Update = 2

ultipa.connection.commonUql module

class ultipa.connection.commonUql.GetProperty[source]

Bases: object

edge: str = 'show().edge_property()'
node: str = 'show().node_property()'
class ultipa.connection.commonUql.GetPropertyBySchema[source]

Bases: object

edge: str = 'show().edge_schema()'
node: str = 'show().node_schema()'

ultipa.connection.connection module

class ultipa.connection.connection.Connection(host: str, defaultConfig: UltipaConfig, crtFilePath: str | None = None)[source]

Bases: DownloadExtra, UserExtra, NodeExtra, EdgeExtra, LteUfeExtra, IndexExtra, PolicyExtra, TaskExtra, ExportExtra, TruncateExtra, AlgoExtra, SubGraphExtra

The object of Ultipa connection.

static GetConnection(defaultConfig: ~ultipa.configuration.UltipaConfig.UltipaConfig = <ultipa.configuration.UltipaConfig.UltipaConfig object>)[source]
static NewConnection(defaultConfig: ~ultipa.configuration.UltipaConfig.UltipaConfig = <ultipa.configuration.UltipaConfig.UltipaConfig object>)[source]
RunHeartBeat(time: int)[source]
StopHeartBeat()[source]

ultipa.connection.connectionBase module

class ultipa.connection.connectionBase.ConnectionBase(host: str, defaultConfig: UltipaConfig, crtFilePath: str | None = None)[source]

Bases: object

A base class that defines settings for an Ultipa connection.

getClientInfo(clientType: int = 0, graphSetName: str = '', uql: str = '', isGlobal: bool = False, ignoreRaft: bool = False, useHost: str | None = None, useMaster: bool = False, timezone=None, timeZoneOffset=None)[source]
getGraphSetName(currentGraphName: str, uql: str = '', isGlobal: bool = False)[source]
getRaftLeader(requestConfig: ~ultipa.configuration.RequestConfig.RequestConfig = <ultipa.configuration.RequestConfig.RequestConfig object>)[source]
getTimeout(timeout: int)[source]
keepConnectionAlive(timeIntervalSeconds: int | None = None)[source]
refreshRaftLeader(redirectHost: str, requestConfig: RequestConfig)[source]
stopConnectionAlive()[source]

ultipa.connection.connectionPool module

class ultipa.connection.connectionPool.UltipaConnectionPool(defaultConfig: ~ultipa.configuration.UltipaConfig.UltipaConfig = <ultipa.configuration.UltipaConfig.UltipaConfig object>)[source]

Bases: object

Ultipa connection pool class.

destroyConn(conn)[source]
get_conn() ConnectionBase[source]

ultipa.connection.connectionPoolMaker module

class ultipa.connection.connectionPoolMaker.ConnectionPool(create, close=None, max_size=3, max_usage=0, ttl=0, idle=120, block=True)[source]

Bases: object

Connection pool

item()[source]
release(conn)[source]
exception ultipa.connection.connectionPoolMaker.Expired[source]

Bases: Exception

exception ultipa.connection.connectionPoolMaker.IdleExceeded[source]

Bases: Expired

exception ultipa.connection.connectionPoolMaker.TooManyConnections[source]

Bases: Exception

exception ultipa.connection.connectionPoolMaker.TtlExceeded[source]

Bases: Expired

exception ultipa.connection.connectionPoolMaker.UsageExceeded[source]

Bases: Expired

class ultipa.connection.connectionPoolMaker.WrapperConnection(pool, connection)[source]

Bases: object

reset()[source]
using()[source]

ultipa.connection.hostManager module

class ultipa.connection.hostManager.HostManager(graphSetName: str, host: str, username: str, password: str, crt: str, maxRecvSize: int)[source]

Bases: object

Client manager class for managing Ultipa connection on behalf of client end.

algoClientInfos: List[GrpcClientInfo] = []
chooseClientInfo(clientType: int, uql: str, consistency: bool, useHost: str, useMaster: bool)[source]

Three rules: send write to leader, sent algorithm to follower, send read to all-3-node for load balancing. Select the connection object. :param clientType: the type of connection :return:

crt: str
defaultClientInfo: GrpcClientInfo = None
followersPeerInfos: List[RaftPeerInfo] = None
getAllClientInfos(ignoreAlgo: bool = False, needUnset: bool = True)[source]
getAllHosts()[source]
graphSetName: str
leaderClientInfo: GrpcClientInfo = None
leaderHost: str
leaderInfos: RaftPeerInfo = None
nullClientInfos: GrpcClientInfo = None
otherFollowerClientInfos: List[GrpcClientInfo] = []
otherUnsetFollowerClientInfos: List[GrpcClientInfo] = []
password: str
raftReady: bool = False
setClients(leaderHost: str, followersPeerInfos: List[RaftPeerInfo], leaderInfos: RaftPeerInfo)[source]
username: str

ultipa.connection.hostManagerControl module

class ultipa.connection.hostManagerControl.HostManagerControl(initHost: str, username: str, password: str, maxRecvSize: int = -1, crt: str | None = None, consistency: bool = False)[source]

Bases: object

Class that defines settings for controlling the connection object.

allHostManager: dict = {}
chooseClientInfo(type: int, uql: str, graphSetName: str, useHost: str | None = None, useMaster: bool = False)[source]
consistency: bool = False
crt: str = None
getAllClientInfos(graph)[source]
getAllHostStatusInfo(graph)[source]
getAllHosts()[source]
getHostManger(graphSetName: str)[source]
initHost: str = None
password: str = None
upsetHostManger(graphSetName: str, initHost: str)[source]
username: str = None

ultipa.connection.uqlHelper module

class ultipa.connection.uqlHelper.UQLHelper(uql: str)[source]

Bases: object

Class that defines settings for UQL processing.

static uqlIsAlgo(uql: str)[source]

Judge whether the UQL is an algorithm operation.

Args:

uql: a uql statement

Returns:

static uqlIsExecTask(uql: str)[source]
static uqlIsExtra(uql: str)[source]
static uqlIsForceUseMaster(uql: str)[source]
uqlIsGlobal()[source]

Judge whether the UQL is Global.

Args:

uql: a uql statement

Returns:

static uqlIsWrite(uql: str)[source]

Judge whether the UQL is a write operation.

Args:

uql: a uql statement

Returns:

Module contents