Command Line Interface (CLI)
Kùzu provides a CLI shell through which you can issue Cypher queries or CALL
commands to query
metadata. See the installation docs for instructions on how
to install the CLI and the quick start page for its basic usage.
Start the shell
Kùzu supports on-disk, as well as in-memory databases. The functionality of the CLI is identical for both on-disk and in-memory modes.
On-disk database
You can create an on-disk database in the CLI by specifying a path after
the kuzu
command in the terminal. This opens the database on-disk, in read-write mode, and the
data is persisted to disk after the CLI shell is closed. Note that if the database
directory does not exist, it will be created for you.
In-memory database
Alternatively, you can create an in-memory database by omitting the path entirely, and just calling kuzu
from your terminal:
Shell commands
Once you start the shell, you can issue Cypher queries as shown in the get started
section. List all available shell commands by running ./kuzu -h
.
:help
Show built-in command list within the Kùzu shell.
:clear
Clear shell. Alternatively, you can use Ctrl + L
to clear the shell.
:quit
Exit from shell. Alternatively, you can use Ctrl + D
to exit the shell.
:max_rows [max_rows]
Set maximum number of rows for display. 0 defaults to 20.
:max_width [max_width]
Set maximum width in characters for display. Defaults to terminal width if unable to display first and last columns.
:mode [mode]
Set output mode. The default mode is box
. See the output modes section below for more details.
:stats [on|off]
Toggle query statistics on or off. The default is on
. Query statistics include the number of tuples, columns, and execution time.
Interrupt shell
To interrupt a running query, use Ctrl + C
in CLI. Note: We currently don’t support interrupting a running COPY
statement.
Non-interactive usage
You can also read and process a file in non-interactive mode via the CLI. Consider that you have the following DDL file:
Pipe the file content to the CLI as follows:
Query progress
For queries that might take a significant amount of time to execute, a progress bar can be enabled that displays the number of pipelines that have been executed (each query is broken down into one or more pipelines), as well as the percentage of the data processed in a pipeline. This gives an estimate for how much of a pipeline has executed.
The progress bar is not enabled by default. To enable the progress bar, use the following command:
To further configure the progress bar, see the configuration section.
Output modes
The :mode [mode]
command allows you to change the appearance of the tables returned by queries.
To view the available modes, use the :mode
command without any arguments:
To change the output mode, use the :mode
command followed by the desired mode:
The :max_rows
and :max_width
commands can be used to control the number of rows and the width
of the box
, column
, table
, and markdown
output modes.