Server Connection and Authentication

2.1 User Authentication

  • Authentication requires users to provide username, password and the file path of CA certificate when establishing connection with Server:

    from ultipa import Connection
    conn=Connection(host='host:port', username="root", password="root", 

2.2 Use cases

  • For non-cluster deployment, obtain the connection object through Connection after the authentication is passed:

    from ultipa import Connection
    conn = Connection(host='host:port', username="root", password="root")
    ret = conn.test()
    # If ret is True, it means Ultipa Server is successfully connected
    # The default graphset is used
  • For cluster deployment, the connection object is obtained through Connection.GetConnection:

    from ultipa import Connection
    conn = Connection.GetConnection(
      username="root", password="root")
    ret = conn.test()
  • To switch graphset:

    from ultipa import Connection,DefaultConfig
    # 1 Specify the desired graphset before establishing server connection:
    default = DefaultConfig(graphSetName='a')
    conn = Connection(host='host:port', username="root", 
    # 2 Or modify the graphset after obtaining the connction object:
    # conn.defaultConfig.graphName='a'
    # 3 Or, pass in Common object when a method is called:
    # conn.searchNode(ULTIPA_REQUEST.SearchNode(limit=10),
    #             ULTIPA_REQUEST.Common(graphSetName='a'))
    ret = conn.test()