diff --git a/docs-2.0/3.ngql-guide/1.nGQL-overview/1.overview.md b/docs-2.0/3.ngql-guide/1.nGQL-overview/1.overview.md index 4ea2605b33b..c702b464146 100644 --- a/docs-2.0/3.ngql-guide/1.nGQL-overview/1.overview.md +++ b/docs-2.0/3.ngql-guide/1.nGQL-overview/1.overview.md @@ -100,7 +100,7 @@ nebula> CREATE TAG IF NOT EXISTS player(name string, age int); |语句|-|不支持 openCypher 9 的所有 DML 语句(如`CREATE`、`MERGE`等),不支持所有的 DCL, 和支持部分 `MATCH` 语法和函数(不支持`OPTIONAL MATCH`,不支持多`MATCH`,不支持 `WHERE` 中使用图 pattern)。 | |语句文本换行 | 换行符 | `\` + 换行符 | |Label 与 Tag 是不同的概念| Label 用于寻找点(点的索引)。 | Tag 用于定义点的一种类型及相应的属性,无索引功能。 | -| 预编译与参数化查询 | 支持 | 不支持 | +| 预编译与参数化查询 | 支持 | 仅支持参数化查询。 | !!! compatibility diff --git a/docs-2.0/nebula-console.md b/docs-2.0/nebula-console.md new file mode 100644 index 00000000000..d5d3018e695 --- /dev/null +++ b/docs-2.0/nebula-console.md @@ -0,0 +1,167 @@ +# Nebula Console + +Nebula Console 是 Nebula Graph 的原生命令行客户端,用于连接 Nebula Graph 集群并执行查询,同时支持管理参数、导出命令的执行结果、导入测试数据集等。 + +使用 Nebula Console 连接 Nebula Graph 请参见[步骤 3:连接 Nebula Graph](2.quick-start/3.connect-to-nebula-graph.md)。 + +!!! note + + 命令不区分大小写。 + +## 管理参数 + +可以保存参数,用于参数化查询。 + +!!! note + + - VID 不支持参数化查询。 + + - `SAMPLE`子句中不支持参数化查询。 + + - 会话释放后,参数不会保留。 + +保存参数命令如下: + +```ngql +nebula> :param => ; +``` + +示例: + +```ngql +nebula> :param p1 => "Tim Duncan"; +nebula> MATCH (v:player{name:$p1})-[:follow]->(n) RETURN v,n; ++----------------------------------------------------+-------------------------------------------------------+ +| v | n | ++----------------------------------------------------+-------------------------------------------------------+ +| ("player100" :player{age: 42, name: "Tim Duncan"}) | ("player125" :player{age: 41, name: "Manu Ginobili"}) | +| ("player100" :player{age: 42, name: "Tim Duncan"}) | ("player101" :player{age: 36, name: "Tony Parker"}) | ++----------------------------------------------------+-------------------------------------------------------+ + +nebula> :param p2 => {"a":3,"b":false,"c":"Tim Duncan"}; +nebula> RETURN $p2.b AS b; ++-------+ +| b | ++-------+ +| false | ++-------+ +``` + +查看当前保存的参数命令如下: + +```ngql +nebula> :params; +``` + +## 导出执行结果 + +导出命令执行的返回结果,可以保存为 CSV 文件或 DOT 文件。 + +!!! note + + - 文件保存在当前工作目录中,即 Linux 命令`pwd`显示的目录。 + + - 命令只对下一条查询语句生效。 + + - DOT 文件的内容可以复制后在 [GraphvizOnline](https://dreampuf.github.io/GraphvizOnline/) 网页中粘贴,生成可视化的执行计划图。 + +- 导出 CSV 文件命令如下: + + ```ngql + nebula> :CSV ; + ``` + +- 导出 DOT 文件命令如下: + + ```ngql + nebula> :dot ; + ``` + + 示例: + + ```ngql + nebula> :dot a.dot; + nebula> PROFILE FORMAT="dot" GO FROM "player100" OVER follow; + ``` + +## 加载测试数据集 + +测试数据集名称为 nba,详细 Schema 信息和数据信息请使用相关`SHOW`命令查看。 + +加载测试数据集命令如下: + +```ngql +nebula> :play nba; +``` + +## 重复执行 + +重复执行下一个命令 N 次,然后打印平均执行时间。命令如下: + +```ngql +nebula> :repeat N; +``` + +示例: + +```ngql +nebula> :repeat 3; +nebula> GO FROM "player100" OVER follow YIELD dst(edge); ++-------------+ +| dst(EDGE) | ++-------------+ +| "player101" | +| "player125" | ++-------------+ +Got 2 rows (time spent 2602/3214 us) + +Fri, 20 Aug 2021 06:36:05 UTC + ++-------------+ +| dst(EDGE) | ++-------------+ +| "player101" | +| "player125" | ++-------------+ +Got 2 rows (time spent 583/849 us) + +Fri, 20 Aug 2021 06:36:05 UTC + ++-------------+ +| dst(EDGE) | ++-------------+ +| "player101" | +| "player125" | ++-------------+ +Got 2 rows (time spent 496/671 us) + +Fri, 20 Aug 2021 06:36:05 UTC + +Executed 3 times, (total time spent 3681/4734 us), (average time spent 1227/1578 us) +``` + +## 睡眠 + +睡眠 N 秒。常用于修改 Schema 的操作中,因为修改 Schema 是异步实现的,需要在下一个心跳周期才同步数据。命令如下: + +```ngql +nebula> :sleep N; +``` + +## 断开连接 + +用户可以使用`:EXIT`或者`:QUIT`从 Nebula Graph 断开连接。为方便使用,Nebula Console 支持使用不带冒号(:)的小写命令,例如`quit`。 + +示例: + +```ngql +nebula> :QUIT; + +Bye root! +``` + +## 常见问题 + +### 如何通过源码安装 Nebula Console? + +下载和编译 Nebula Console 的最新源码,请参见 [GitHub nebula console](https://github.com/vesoft-inc/nebula-console#build-nebula-graph-console) 页面的说明。 diff --git a/docs-2.0/reuse/source_connect-to-nebula-graph.md b/docs-2.0/reuse/source_connect-to-nebula-graph.md index 27bca556ebc..cc4d111fb06 100644 --- a/docs-2.0/reuse/source_connect-to-nebula-graph.md +++ b/docs-2.0/reuse/source_connect-to-nebula-graph.md @@ -78,134 +78,3 @@ Nebula Graph 支持多种类型客户端,包括 CLI 客户端、GUI 客户端 | `-f/-file` | 设置存储 nGQL 语句的文件的路径。连接成功后会执行该文件内的 nGQL 语句并返回结果,执行完毕后自动断开连接。 | 用户可以使用`./nebula-console --help`命令获取所有参数的说明,也可以在[项目仓库](https://github.com/vesoft-inc/nebula-console/tree/{{console.branch}})找到更多说明。 - -## Nebula Console 命令 - -Nebula Console 提供部分命令,可以导出 CSV 文件、导出 DOT 文件、导入测试数据集等。 - -!!! note - - 命令不区分大小写。 - -### 导出 CSV 文件 - -CSV 文件用于保存命令执行的返回结果。 - -!!! note - - - CSV 文件保存在当前工作目录中,即 Linux 命令`pwd`显示的目录。 - - - 命令只对下一条查询语句生效。 - -导出 CSV 文件命令如下: - -```ngql -nebula> :CSV -``` - -### 导出 DOT 文件 - -DOT 文件同样用于保存命令执行的返回结果,其保存的结果信息和 CSV 文件不同。 - -!!! Note - - - DOT 文件保存在当前工作目录中,即 Linux 命令`pwd`显示的目录。 - - - DOT 文件的内容可以复制后在 [GraphvizOnline](https://dreampuf.github.io/GraphvizOnline/) 网页中粘贴,生成可视化的执行计划图。 - - - 命令只对下一条查询语句生效。 - -导出 DOT 文件命令如下: - -```ngql -nebula> :dot -``` - -示例: - -```ngql -nebula> :dot a.dot -nebula> PROFILE FORMAT="dot" GO FROM "player100" OVER follow; -``` - -### 加载测试数据集 - -测试数据集名称为 nba,详细 Schema 信息和数据信息请使用相关`SHOW`命令查看。 - -加载测试数据集命令如下: - -```ngql -nebula> :play nba -``` - -### 重复执行 - -重复执行下一个命令 N 次,然后打印平均执行时间。命令如下: - -```ngql -nebula> :repeat N -``` - -示例: - -```ngql -nebula> :repeat 3 -nebula> GO FROM "player100" OVER follow YIELD dst(edge); -+-------------+ -| dst(EDGE) | -+-------------+ -| "player101" | -| "player125" | -+-------------+ -Got 2 rows (time spent 2602/3214 us) - -Fri, 20 Aug 2021 06:36:05 UTC - -+-------------+ -| dst(EDGE) | -+-------------+ -| "player101" | -| "player125" | -+-------------+ -Got 2 rows (time spent 583/849 us) - -Fri, 20 Aug 2021 06:36:05 UTC - -+-------------+ -| dst(EDGE) | -+-------------+ -| "player101" | -| "player125" | -+-------------+ -Got 2 rows (time spent 496/671 us) - -Fri, 20 Aug 2021 06:36:05 UTC - -Executed 3 times, (total time spent 3681/4734 us), (average time spent 1227/1578 us) -``` - -### 睡眠 - -睡眠 N 秒。常用于修改 Schema 的操作中,因为修改 Schema 是异步实现的,需要在下一个心跳周期才同步数据。命令如下: - -```ngql -nebula> :sleep N -``` - -### 断开连接 - -用户可以使用`:EXIT`或者`:QUIT`从 Nebula Graph 断开连接。为方便使用,Nebula Console 支持使用不带冒号(:)的小写命令,例如`quit`。 - -示例: - -```ngql -nebula> :QUIT - -Bye root! -``` - -## 常见问题 - -### 如何通过源码安装 Nebula Console? - -下载和编译 Nebula Console 的最新源码,请参见 [GitHub nebula console](https://github.com/vesoft-inc/nebula-console#build-nebula-graph-console) 页面的说明。 diff --git a/mkdocs.yml b/mkdocs.yml index 7e8573e582e..3c1d8d8cada 100755 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -354,6 +354,8 @@ nav: - Nebula Python: 14.client/5.nebula-python-client.md - Nebula Go: 14.client/6.nebula-go-client.md + - Nebula Console: nebula-console.md + - Nebula Graph Studio: - Studio 版本更新说明: nebula-studio/about-studio/st-ug-release-note.md - 认识 Nebula Graph Studio: