UltipaDocs
Try Playground
  • Introduction
  • RESTful API
    • Installation
    • Connection
      • Request Configuration
      • Querying Methods
      • UQL Execution
      • Graphset Management
      • Schema and Property Management
      • Data Insertion and Deletion
      • Query Acceleration
      • Algorithm Management
      • Downloads and Exports
      • Process and Task Management
      • Access Management
      • Others
    • Result Processing
    • Types Mapping
    • Installation
    • Connection
      • Request Configuration
      • Querying Methods
      • UQL Execution
      • Graphset Management
      • Schema and Property Management
      • Data Insertion and Deletion
      • Query Acceleration
      • Algorithm Management
      • Downloads and Exports
      • Process and Task Management
      • Access Management
      • Others
    • Result Processing
    • Types Mapping
    • Installation
    • Connection
      • Request Configuration
      • Querying Methods
      • UQL Execution
      • Graphset Management
      • Schema and Property Management
      • Data Insertion and Deletion
      • Query Acceleration
      • Algorithm Management
      • Downloads and Exports
      • Process and Task Management
      • Access Management
      • Others
    • Result Processing
    • Types Mapping
    • Installation
    • Connection
      • Request Configuration
      • Querying Methods
      • UQL Execution
      • Graphset Management
      • Schema and Property Management
      • Data Insertion and Deletion
      • Query Acceleration
      • Algorithm Management
      • Downloads and Exports
      • Process and Task Management
      • Access Management
      • Others
    • Result Processing
    • Types Mapping
    • Installation
    • Connection
      • Request Configuration
      • Querying Methods
      • UQL Execution
      • Graphset Management
      • Schema and Property Management
      • Data Insertion and Deletion
      • Query Acceleration
      • Algorithm Management
      • Downloads and Exports
      • Process and Task Management
      • Access Management
      • Others
    • Result Processing
    • Types Mapping
  1. Docs
  2. /
  3. Ultipa Drivers
  4. /
  5. Database Querying

Database Querying

Request Configuration

All querying methods support an optional request configuration parameter (RequestConfig or InsertRequestConfig) to customize the behavior of requests made to the database. This parameter allows you to specify various settings, such as graphset name, timeout, and host, to tailor your requests according to your needs.

RequestConfig

RequestConfig defines the information needed when sending non-insert type of requests to the database.

Go
package main

import (
  "log"

  "github.com/ultipa/ultipa-go-sdk/sdk"
  "github.com/ultipa/ultipa-go-sdk/sdk/configuration"
)

func main() {

  config, _ := configuration.NewUltipaConfig(&configuration.UltipaConfig{
    Hosts:    []string{"192.168.1.85:60061", "192.168.1.86:60061", "192.168.1.87:60061"},
    Username: "***",
    Password: "***",
  })

  conn, _ := sdk.NewUltipa(config)

  requestConfig := &configuration.RequestConfig{
    GraphName:   "miniCircle",
    RequestType: configuration.RequestType_Task,
  }

  uqlResult, err := conn.Uql("find().nodes({@account.year > 2000}) as nodes return nodes{*} limit 5", requestConfig)

  log.Print(uqlResult, err)

}

RequestConfig has the following fields:

ItemTypeDefault ValueDescription
GraphNamestringName of the graph to use. If not set, use the graphSetName configured when establishing the connection.
Timeoutint321000Request timeout threshold in seconds.
ClusterIdstringSpecifies the cluster to use.
HoststringSends the request to a designated host node, or to a random host node if not set.
UseMasterboolFALSESends the request to the leader node to guarantee consistency read if set to true.
UseControlboolFALSESends the request to the control node if set to true.
RequestTypeRequestType or int320Sends the requset to a node according to the request type:
RequestType_Write or 1: to leader node
RequestType_Task or 2: to algo
RequestType_Normal or 3: to a random host
UqlstringUQL for internal program
TimezonestringThe time zone to use.
TimezoneOffsetint64The amount of time that the time zone in use differs from UTC in seconds.
ThreadNumuint32Number of threads.
MaxPkgSizeint10MMax package size in bytes, for both sending and receiving.

InsertRequestConfig

InsertRequestConfig defines the settings needed when sending data insertion or deletion requests to the database.

Go
package main

import (
  ultipa "github.com/ultipa/ultipa-go-sdk/rpc"
  "github.com/ultipa/ultipa-go-sdk/sdk"
  "github.com/ultipa/ultipa-go-sdk/sdk/configuration"
  "github.com/ultipa/ultipa-go-sdk/sdk/structs"
)

func main() {

  config, _ := configuration.NewUltipaConfig(&configuration.UltipaConfig{
    Hosts:    []string{"192.168.1.85:60061", "192.168.1.86:60061", "192.168.1.87:60061"},
    Username: "***",
    Password: "***",
  })

  conn, _ := sdk.NewUltipa(config)

  requestConfig := &configuration.RequestConfig{
    GraphName: "test",
  }
  insertRequestConfig := &configuration.InsertRequestConfig{
    RequestConfig: requestConfig,
    InsertType:    ultipa.InsertType_OVERWRITE,
  }

  var nodes []*structs.Node

  newNode1 := structs.NewNode()
  newNode1.Schema = "card"
  newNode1.ID = "ULTIPA8000000000000001"
  newNode1.Set("amount", float32(3235.2))
  nodes = append(nodes, newNode1)

  newNode2 := structs.NewNode()
  newNode2.Schema = "client"
  newNode2.ID = "ULTIPA8000000000000007"
  newNode2.Set("level", int32(77))
  nodes = append(nodes, newNode2)

  conn.InsertNodesBatchAuto(nodes, insertRequestConfig)

}

InsertRequestConfig has the following fields:

ItemType
Default Value
Description
GraphNamestringName of the graph to use. If not set, use the graphSetName configured when establishing the connection.
Timeoutint321000Request timeout threshold in seconds.
ClusterIdstringSpecifies the cluster to use.
HoststringSends the request to a designated host node, or to a random host node if not set.
UseMasterboolFALSESends the request to the leader node to guarantee consistency read if set to true.
UseControlboolFALSESends the request to the control node if set to true.
RequestTypeRequestType or int320Sends the requset to a node according to the request type:
RequestType_Write or 1: to leader node
RequestType_Task or 2: to algo
RequestType_Normal or 3: to a random host
UqlstringUQL for internal program.
TimezonestringThe time zone to use.
TimezoneOffsetint64The amount of time that the time zone in use differs from UTC in seconds.
ThreadNumuint32Number of threads.
MaxPkgSizeint10MMax package size in bytes, for both sending and receiving.
InsertTypeultipa.InsertType or int320Insert mode:
InsertType_NORMAL (or 0)
InsertType_OVERWRITE (or 1)
InsertType_UPSERT (or 2)
CreateNodeIfNotExistboolFALSEWhether to create start/end nodes of an edge if the end nodes do not exist in the graph.
SilentboolFALSEWhether to keep slient after success insertion, i.e., whether to return the inserted nodes or edges.