Ultipa CLI (ultipa_cli
) is a cross-platform (Windows/Mac/Linux) command line interface designed for executing GQL and UQL queries against Ultipa graph databases.
Prerequisites
- A command line terminal.
- Linux or MacOS: Bash, Zsh, TCSH
- Windows: PowerShell
- Download Ultipa CLI from here. No installation is required.
Usage Guides
The following steps are demonstrated using PowerShell (Windows).
1. Open Terminal
Open the terminal program and navigate to the folder containing ultipa_cli
.
2. Connect to Ultipa
Run ultipa_cli
and connect to the database.
./ultipa_cli.exe -h <host_addr> -u <username> -p <password>
ultipa_cli
supports the following flags when establishing connection to Ultipa:
Flag |
Parameter | Optional |
---|---|---|
-h , --host |
Database host address provided as a URL (excluding https:// or http:// ) or IP:Port ; if connecting to a cluster, provide multiple IP:Port pairs separated by commas |
No |
-u , --username |
Database username for host authentication | No |
-p , --password |
Password of the above database user | No |
-g , --graph |
The graph to set as the current working graph; the default is default |
Yes |
-qt , --queryType |
The query type: uql (default) or gql |
Yes |
-crt , --crt |
Local TSL file path for encrypting the transmission | Yes |
-d , --debug |
A boolean flag, use it to enable the debug mode | Yes |
-t , --timeout |
Timeout threshold in seconds for requests | Yes |
3. Specify Working Graph
Specify the current working graph using the use
command. Take the graph named alimama as an example.
use alimama
4. Execute Queries
ultipa_cli
has UQL and GQL mode. By default, it is in the UQL mode.
UQL Queries
Execute a UQL query:
find().nodes({@nodx.cateID == "1089685"}) as n return n{*} limit 5
Switch Between UQL and GQL
You can switch between the UQL and GQL mode using the uql
and gql
commands.
gql
GQL Queries
Execute a GQL query:
MATCH (n:nodx {cateID: "1089685"}) RETURN n LIMIT 5
Version Check
You can check the version of ultipa_cli
with the -version
or --version
flag.
UQL Execution History
The .ultipa_cli_history
file is automatically generated in the same directory as ultipa_cli
upon your successful connection to the database, provided the file does not already exist. The file logs all commands executed within ultipa_cli
, appending any new commands to the end of the file if it exists. This file helps users keep track of their command history for reference and easy re-execution.