OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Tugraph

V3.3.3Enterprise Edition

  • Guide
    • What is a graph
    • What is a graph database
    • TuGraph Quick Start
  • Operating
    • Introduction
    • Installation
    • Data Importing
    • Service configuration
    • Service operations
    • Tools
      • tugraph_cypher Instructions
      • TuGraph Browser
      • TuGraph DataX Instructions
      • TuGraph Explore Instructions
    • High Availability mode
    • Database Management
    • User rights Management
  • Developer Document
    • TuGraph RESTful API
    • TuGraph-Cypher
    • TuGraph Stored Procedure Guide
    • Graph Analytics Engine
      • Bootstrap program
      • OlapBase API
      • OlapOnDB API
      • OlapOnDisk API
      • TuGraph Built-in Algorithm Description
  • Client
    • TuGraph Java SDK
    • TuGraph Python SDK
    • TuGraph C++ SDK
  • Supplement
    • Update the content description
  • Community
    • TuGraph Contribution Guide
    • TuGraph community roles
    • TuGraph Open source planning
    • Ant_Group_Open_Source_Individual_CLA_English_Chinese_2021
    • Ant_Group_Open_Source_Corporate_CLA_English_Chinese_2021

Download PDF

What is a graph What is a graph database TuGraph Quick Start Introduction Installation Data Importing Service configuration Service operations tugraph_cypher Instructions TuGraph Browser TuGraph DataX Instructions TuGraph Explore Instructions High Availability mode Database Management User rights Management TuGraph RESTful API TuGraph-Cypher TuGraph Stored Procedure Guide Bootstrap program OlapBase API OlapOnDB API OlapOnDisk API TuGraph Built-in Algorithm Description TuGraph Java SDK TuGraph Python SDK TuGraph C++ SDK Update the content description TuGraph Contribution Guide TuGraph community roles TuGraph Open source planningAnt_Group_Open_Source_Individual_CLA_English_Chinese_2021Ant_Group_Open_Source_Corporate_CLA_English_Chinese_2021
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogLive DemosTraining & Certification
Company
About OceanBaseTrust CenterLegalPartnerContact Us
Follow Us

© OceanBase 2026. All rights reserved

Cloud Service AgreementPrivacy PolicySecurity
Contact Us
Document Feedback
  1. Documentation Center
  2. OceanBase Tugraph
  3. V3.3.3
iconOceanBase Tugraph
V 3.3.3Enterprise Edition

tugraph_cypher Instructions

Last Updated:2023-06-25 03:23:24  Updated
share
What is on this page
Single command mode
Command line Parameters:
Examples:
Interactive mode
Enter lgraph_cypher interaction mode:
Command Description
cypher query command:
Auxiliary Features:

folded

share

This document describes the use of the lgraph_cypher

The TuGraph release comes with a query client named 'lgraph_cypher' that can be used to submit OpenCypher requests to the TuGraph server. The 'lgraph_cypher' client has two execution modes: single command mode and interactive mode.

Single command mode

In single-command mode, 'lgraph_cypher' can be used to submit a single Cypher query and print the result directly to the terminal. The printed result can also be easily redirected to a specified file. This is handy when users need to get a lot of results from the server and save them in files.

In this mode, the 'lgraph_cypher' tool has the following options:

Command line Parameters:

Parameter Type Instructions
--help \ List all parameters and descriptions.
-example \ List the command instances.
-c string A database configuration file used to obtain ip and port information.
-h string Database server IP address. Omit this parameter if you have a configuration file. The default value is' 127.0.0.1 '
-p string Database server port. Omit this parameter if you have a configuration file. The default value is 7071
-u string User name for logging in to the database.
-P string Password for logging in to the database.
-f string Contains the path to a single Cypher query single text file.
-s string Single-line cypher query command. Start and end with ".
-t int Specifies the server timeout threshold for cypher queries. The default value is 150 seconds.
-format string Query result display mode. Supports two formats: 'plain' and 'table'. The 'plain' format prints the query results in a single column. The 'table' format displays the query results in a tabular format. The default value is' table '

Examples:

cypher command file query:


$ ./lgraph_cypher.py -c /home/usr/lgraph_standalone.json -u user -P password -f /home/usr/cypher.json

cypher command single-sentence query:


$ ./lgraph_cypher.py -c /home/usr/lgraph_standalone.json -u user -P password -s "MATCH (n) RETURN n"

Interactive mode

'lgraph_cypher' can also be run in interactive mode. In interactive mode, the client stays connected to the server and interacts with the user in read-evaluate-print-loop.

Enter lgraph_cypher interaction mode:

If no '-f' or '-s' command line option added, 'lgraph_cypher' will enter interactive mode when running. how to use it:


$ ./lgraph_cypher.py -c /home/usr/lgraph_standalone.json -u admin -P 73@TuGraph

If the login is successful, the corresponding login success message will be displayed:

**********************************************************************
*                  TuGraph Graph Database X.Y.Z                      *
*                                                                    *
*        Copyright(C) 2018 Ant Group. All rights reserved.           *
*                                                                    *
**********************************************************************
login success
----------------------------------
Host: 127.0.0.1
Port: 7071
Username: admin
----------------------------------
type ":help" to see all commands.
>

Now we also provide an interactive shell for users to enter Cypher queries or use the ':help' command to check for available commands.

Command Description

In addition to the Cypher query, the shell of 'lgraph_cypher' accepts the following commands:

Command Parameters instructions
:help \ Displays the server information and the corresponding description of all commands.
:db_info \ Query the current server status. /db/info for the corresponding REST API.
:clear \ Clear the screen.
:use {Graph Name} The graph specified with this name defaults to default
:source -t {Query the timeout value} -f {The query file} cypher command file query in interactive mode. The default timeout threshold is 150 seconds. Query file format reference No interactive query parameters.
:exit \ Exit interactive mode and return to the original command line.
:format plain or table Change the display mode of cypher query results. Support 'plain' and 'table' modes.
:save all/command/result -f {The file path} {Cypher} The cypher command (command), query result (result) or both (all) are stored. The default location is' /saved_cypher.txt '

Note:

  • Each command should start with a colon :.

:save command example :

:save all -f /home/usr/saved.txt match (n) where return n, n.name limit 1000

cypher query command:

In interactive mode, users can also directly input a single sentence cypher command for query, with "'; ` "end. Enter commands that are case insensitive. Here's an example:

login success
>MATCH (n) RETURN n, n.name;
+---+---+-------------+
|   | n |n.name       |
+---+---+-------------+
| 0 | 0 |david        |
| 1 | 1 |Ann          |
| 2 | 2 |first movie  |
| 3 | 3 |Andres       |
+---+---+-------------+
time spent: 0.000520706176758
size of query: 4
>

lgraph_cypher supports multi-line input when typing commands. Users can use the ENTER key to type long query statements into multiple lines. In the case of multi-line input, the beginning of the command line will change from > to =>, and the user can continue to type the rest of the query.

Example:

login success
>MATCH (n)
=>WHERE n.uid='M11'
=>RETURN n, n.name;

Auxiliary Features:

Input History: Press the up and down arrow keys in interactive mode to display the input history.

Auto Completion: lgraph_cypher will automatically complete based on the input history. In the event of a completion prompt, pressing the right arrow key will automatically complete the command.

Previous topic

Service operations
Last

Next topic

TuGraph Browser
Next
What is on this page
Single command mode
Command line Parameters:
Examples:
Interactive mode
Enter lgraph_cypher interaction mode:
Command Description
cypher query command:
Auxiliary Features: