Skip to main content

GraphScope CLI shell for NeuG

Project description

Neug CLI Tool

The Neug CLI tool provides an interactive shell for querying and managing NeuG database. It supports both local and remote database connections, Cypher query execution, and result formatting.

Installation

You can install ngcli using pip:

pip install ngcli

Alternatively, to install from source:

git clone https://github.com/GraphScope/neug.git
cd neug/tools/shell
pip install .

After installation, you can verify that ngcli is installed correctly by running:

ngcli --version

This should display:

ngcli, version 0.1.0

Usage

Overview

The ngcli tool allows you to interact with the Neug database in both local and remote modes. To view the basic usage, run:

ngcli --help

This displays:

Usage: ngcli [OPTIONS] COMMAND [ARGS]...

    Neug CLI Tool.

Options:
    --version  Show the version and exit.
    --help     Show this message and exit.

Commands:
    connect  Connect to a remote database.
    open     Open a local database.

Start the Shell by Opening a Local Database

To open a local Neug database, specify the database path when starting the CLI. By default, the database is opened in read-write mode, and changes are persisted to disk when the shell exits. If the specified directory does not exist, it will be created automatically.

To open the database in read-only mode, use the --readonly or -r option.

ngcli open <path-to-db> [--readonly | -r]
  • --readonly, -r: Open the database in read-only mode.

Start the Shell by Connecting to a Remote Database

To connect to a remote Neug server, specify the server URI when starting the CLI. You can optionally provide a username, password, and query timeout. Note that remote connection support is under development.

ngcli connect <host:port> [--user <username> | -u <username>] [--password <password> | -p <password>] [--timeout <seconds>]
  • --user, -u: Username for authentication.
  • --password, -p: Password for authentication.
  • --timeout: Connection timeout in seconds (default: 300).

Interactive Shell Commands

Once you start the shell, you can execute Cypher queries and use various interactive commands:

  • Enter Cypher queries directly to execute them.
  • Use :help to display this help message.
  • Use :quit or press Ctrl+C to leave the shell.
  • Use :max_rows <number> to set the maximum number of rows to display for query results.
  • Multi-line commands are supported. Use ';' at the end to execute.
  • Command history is supported; use the up/down arrow keys to navigate previous commands.

Example

ngcli open /tmp/modern_graph

This will open embedded Neug database at /tmp/modern_graph in rw mode by default, and start the shell. Then you can execute Cypher queries directly:

Welcome to the Neug shell. Type :help for usage hints.

neug > MATCH (n:person) RETURN n;
+-------------------------------------------------------+
| n                                                     |
+=======================================================+
| {_ID: 0, _LABEL: person, id: 1, name: marko, age: 29} |
+-------------------------------------------------------+
| {_ID: 1, _LABEL: person, id: 2, name: vadas, age: 27} |
+-------------------------------------------------------+
| {_ID: 2, _LABEL: person, id: 4, name: josh, age: 32}  |
+-------------------------------------------------------+
| {_ID: 3, _LABEL: person, id: 6, name: peter, age: 35} |
+-------------------------------------------------------+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ngcli-0.1.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ngcli-0.1.1-py2.py3-none-any.whl (6.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ngcli-0.1.1.tar.gz.

File metadata

  • Download URL: ngcli-0.1.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for ngcli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2fddd648b5ada86ffa33c3378edf47be36c25c9dd31428d398d099922233a977
MD5 04a837d0af4cdb8c33dcc8baed31aad1
BLAKE2b-256 a9a4a59dde66c7908a9ef00dfc06b94b79e36ebd93907a880017463a90b0b61e

See more details on using hashes here.

File details

Details for the file ngcli-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: ngcli-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for ngcli-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 554f7e884a60c5fa7a7318c172153a9abb7d2f6443e077a8ef0b405156cc856f
MD5 20e199022684c0910f50d99597bb72e9
BLAKE2b-256 e55ddab685cdeb67193f04f2191bc77db8fae182625bbe19e71b8316c4c6021a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page