Skip to content

Commit

Permalink
Merge 3.0.0 to master (#1484)
Browse files Browse the repository at this point in the history
* Update deploy.yaml

* Update deploy.yaml

* Update studio & color

* Update mkdocs.yml

* Update 2.balance-syntax.md (#1394)

* update cheatsheet (#1393)

* update cheatsheet

* Update 6.cheatsheet-for-ngql-command.md

* Update 6.cheatsheet-for-ngql-command.md

* studio

* Update 3.vid.md

* Delete overrides/partials directory

* fix links (#1395)

* Update 2.how-to-create-subsciption.md

* Update 3.property-reference.md

* Update 2.boolean.md

* Update 12.hash.md

* update

* Update 2.match.md

* fix links (#1397)

* Update 2.match.md

* Update optional-match.md

* Update 5.lookup.md

* Update 5.lookup.md

* Update 3.go.md

* Update 3.go.md

* Update 3.go.md

* Update 3.go.md

* Space level metrics (#1396)

* space-level-metrics

* Update 4.use-dashboard.md

* updates

* Update limit syntax in GO (#1398)

* Update 3.go.md

* nGQL cheatsheet added (#1399)

* Update 2.deploy-connect-dashboard-ent.md (#1401)

* Add cloud picture and change name (#1402)

* Update 1.install-nebula-graph-by-compiling-the-source-code.md

* Update 5.2.connection-configuration-and-use.md

* Update mkdocs.yml

* fix typo (#1404)

* version correspondence between dashboard & nebula (#1405)

* version correspondence between dashboard & nebula

* version upgrade

* update algorithm (#1406)

* Update limit.md

* Update sample.md

* Update 1.create-space.md

* Update 1.create-space.md

* Update 2.drop-tag.md

* Update README.md

* Update README.md

* Update 4.delete-edge.md

* Update 4.delete-edge.md

* Update 2.graph-modeling.md

* Update 2.1.path.md

* Update 1.insert-edge.md

* Update 2.show-native-indexes.md

* Update nebula-algorithm.md

* Update 2.1.show-create-index.md

* Update 1.text-based-index-restrictions.md

* Update source_manage-service.md

* Update 1.text-based-index-restrictions.md

* Update 4.nebula-graph-crud.md

* Update 2.find-path.md

* Update 2.find-path.md

* Add ranking config in exchange examples (#1407)

* add license check (#1410)

* Update 2.match.md

* Update 2.match.md

* Update nebula-plato.md (#1411)

* Update 1.nebula-client.md

* update start sh

* update stop sh

* update stop sh

* change start service setting

* update start

* Update nebula-plato.md

* Add ranking config in exchange examples (#1412)

* timestamp_in_logfile_name and logrotate faq (#1400)

* Fix exchange conf link (#1414)

* Update note.css

* Update 3.cluster-information.md

* disable balance data (#1416)

* update config shell

* update nebula-dashboard server config

* fix schema rule (#1418)

* Update README.md

* Update 2.deploy-dashboard.md

* Add next step

* Update mkdocs.yml (#1422)

* Update 1.what-is-dashboard-ent.md

* [WIP]update Studio (#1419)

* [WIP]update Studio

* update-0124

* Update st-ug-deploy.md

* [wip] explore 216 --what is explorer & deployment updates (#1417)

* [wip] explore 216 --what is explorer updates

* explorer 216 -- deploy&connect

* Update mkdocs.yml

* Update mkdocs.yml

* [WIP] explorer220-overview (#1421)

* explorer220-overview

* Update ex-ug-page-overview.md

* Update st-ug-what-is-graph-studio.md

* Explorer220 query (#1423)

* explorer220-overview

* explorer 220-query

* Update st-ug-crud-tag.md

* node-filtering (#1424)

* dashboard ent config_file update (#1426)

* dashboard ent config_file update

* Update 2.deploy-connect-dashboard-ent.md

* Create 2.deploy-connect-dashboard-ent.md

* Update 1.insert-edge.md

* Update 2.data-model.md

* Update 2.graph-modeling.md

* dashboard-ent-custom-installation path (#1430)

* dashboard-ent-custom-installation path

* Update 1.create-cluster.md

* update-picture

* Update 1.what-is-dashboard.md

* [WIP] explorer 220 graph-exploration (#1429)

* explorer 220 - canvas (#1433)

* Update 2.deploy-dashboard.md

* Update 2.deploy-dashboard.md

* Update upgrade docs (#1427)

* Update upgrade docs

* Update upgrade docs

* Update upgrade-nebula-from-200-to-latest.md

* Update upgrade-nebula-graph-to-latest.md

* Update upgrade-nebula-graph-to-latest.md

* Update upgrade-nebula-graph-to-latest.md

* Update upgrade-nebula-graph-to-latest.md

* Update upgrade-nebula-graph-to-latest.md

* Update upgrade-nebula-graph-to-latest.md

* Resolve Whitewum's and Harris's comments

* Fix some issues

* update resource calculation

* add caution for date_time_zonespec.csv

* delete zone (#1434)

* manage storage hosts (#1437)

* manage storage hosts

* update

* Update manage-storage-host.md

* Add faq for job id issue (#1438)

* Remove zone (#1439)

* Remove zone (#1440)

* Remove zone

* Update 4.nebula-graph-crud.md

* Exchange support PostgreSQL data source (#1441)

* [WIP] explorer220-updates (#1435)

* explorer220-updates

* updates

* Update mkdocs.yml

* console updates

* Update canvas-overview.md

* Update visualization-mode.md

* Update visualization-mode.md

* show hosts (#1442)

* show hosts

The `show hosts` command displays the version

* Update 6.show-hosts.md

* Update learning-path.md

* Update 2.data-model.md

* Update compaction.md

* Update compaction.md

* Update compaction.md

* Update 3.system-design.md

* Update 3.system-design.md

* Update st-ug-release-note.md

* Update nebula-bench.md

* Update how-to-contribute.md

* Update how-to-contribute.md

* Update 6.eco-tool-version.md

* Update 6.eco-tool-version.md

* Update 0.FAQ.md

* Create 0.FAQ.md (#1443)

* Update use-importer.md

* Update mkdocs.yml

* Update 6.eco-tool-version.md

* update clients (#1444)

* Update 3.system-design.md

* Update ex-ug-deploy.md (#1445)

* Update ex-ug-graph-exploration.md

* update docs (#1446)

* Update ex-ug-graph-exploration.md

* Update 6.kill-query.md (#1448)

* Update 2.deploy-dashboard.md

* Update ex-ug-shortcuts.md

* Update ex-ug-graph-exploration.md (#1449)

* Update st-ug-deploy-by-helm.md (#1450)

* Update explorer-console.md (#1451)

* Update source_connect-to-nebula-graph.md

* Update 5.nebula-python-client.md (#1452)

as we use format string in nebula-python, don't support python3.5

* update

* Update 6.show-hosts.md

* add gifs for dashboard 110 (#1453)

* Update 6.pricing.md

* Update 1.what-is-br.md

* Update 4.storage-service.md

* Update 2.deploy-dashboard.md (#1455)

* Update 1.what-is-nebula-graph.md

* Update mkdocs.yml (#1456)

* Update 2.deploy-dashboard.md (#1457)

* Update 2.deploy-dashboard.md

* Dashboard community deploy&connect updates (#1460)

* deploy&connect updates for dashboard community

* Update mkdocs.yml

* update release notes (#1459)

* update release notes

* update

* update

* update

* Update releasenote.md

* Update 2.deploy-dashboard.md

* Update releasenote.md

* Update releasenote.md

* Update learning-path.md

fix invalid video list url

* Update deploy.yaml

* Update visualization-mode.md (#1463)

* Update ex-ug-compile.md

* Update releasenote.md

* Update releasenote.md

* update br 0211 (#1461)

* update br 0211

* update

* add

* Update 4.br-restore-data.md

* Update 4.br-restore-data.md

* Update 2.compile-br.md

* Update 1.configurations.md

* Update mkdocs.yml

* Update mkdocs.yml

* Update upgrade-nebula-graph-to-latest.md

* Update upgrade-nebula-graph-to-latest.md

* Update upgrade-nebula-graph-to-latest.md

* fixed some issues (#1467)

* Update releasenote.md

* Update 2.deploy-connect-dashboard-ent.md (#1468)

* Update 4.describe-space.md

* Update upgrade-nebula-graph-to-latest.md

* Update releasenote.md

* Create releasenote.md

* Update releasenote.md

* Update mkdocs.yml

* update-br

* Update 2.deploy-connect-dashboard-ent.md

* update branch of client (#1469)

* Update mkdocs.yml

* Update 4.nebula-java-client.md

* update compatibility (#1470)

* Update 3.br-backup-data.md

* Update 3.br-backup-data.md

* Update nebula-plato.md

* Update 3.br-backup-data.md

* Update nebula-plato.md

* Update st-ug-deploy.md

* Update 3.br-backup-data.md

* Update st-ug-deploy.md

* Update 4.br-restore-data.md

* Update 4.br-restore-data.md

* Update 3.br-backup-data.md

* Update st-ug-release-note.md

* Update ex-ug-limitations.md

* Update mkdocs.yml

* Update use-importer.md

* Update use-importer.md

* Update nebula-algorithm.md

* Update config-with-header.md

* Update config-without-header.md

* Update releasenote.md

* Update st-ug-what-is-graph-studio.md

* Update nebula-algorithm.md

* Update nebula-spark-connector.md (#1473)

* Update ex-ug-import-from-mysql.md

* update exchange 3.0.0 (#1474)

* [WIP]change plato name (#1472)

* change plato name

* update

* Update nebula-analytics.md

* Update nebula-analytics.md

* Update 6.eco-tool-version.md

* Update 3.system-design.md

* Update nebula-analytics.md

* Update releasenote.md

* Update releasenote.md

* add br

* Update releasenote.md

* Update releasenote.md

* Update releasenote.md

* Update releasenote.md

* Update learning-path.md

* Update learning-path.md

* Update learning-path.md

* Update learning-path.md (#1476)

* Update nebula-console.md

* Update nebula-console.md (#1477)

* Update studio 3.2.1 (#1478)

* Update 6.eco-tool-version.md (#1479)

* Update logo.css (#1480)

* Update 1.configurations.md (#1481)

* Fix link and add cloud (#1482)

* Update nebula-cloud.md

* Update 6.eco-tool-version.md

* update

* update

Co-authored-by: min.wu <[email protected]>
Co-authored-by: foesa <[email protected]>
Co-authored-by: abby.huang <[email protected]>
Co-authored-by: randomJoe211 <[email protected]>
Co-authored-by: li Nico <[email protected]>
Co-authored-by: Harris.Chu <[email protected]>
Co-authored-by: Steam <[email protected]>
Co-authored-by: Nut He <[email protected]>
  • Loading branch information
9 people authored Mar 7, 2022
1 parent 4ff37ec commit 12b5645
Show file tree
Hide file tree
Showing 296 changed files with 2,160 additions and 1,894 deletions.
2 changes: 1 addition & 1 deletion docs-2.0/1.introduction/1.what-is-nebula-graph.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Nebula Graph 采用 shared-nothing 架构,支持在不停止数据库服务的

### 易开发

Nebula Graph 提供 Java、Python、C++和 Go 等流行编程语言的客户端,更多客户端仍在开发中。详情请参见 [Nebula Graph clients](../14.client/1.nebula-client.md)
Nebula Graph 提供 Java、Python、C++ 和 Go 等流行编程语言的客户端,更多客户端仍在开发中。详情请参见 [Nebula Graph clients](../14.client/1.nebula-client.md)

### 高可靠访问控制

Expand Down
2 changes: 1 addition & 1 deletion docs-2.0/1.introduction/2.1.path.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@

用户也可以观看视频了解路径的相关概念。

[Nebula Algorithm](https://www.bilibili.com/video/BV1Uf4y1t72L)(03 分 09 秒)
[Path](https://www.bilibili.com/video/BV1Uf4y1t72L)(03 分 09 秒)

<iframe src="//player.bilibili.com/player.html?aid=291311326&bvid=BV1Uf4y1t72L&cid=361000311&page=1&high_quality=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" width="720px" height="480px"> </iframe>
10 changes: 8 additions & 2 deletions docs-2.0/1.introduction/2.data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,15 @@ Nebula Graph 数据模型使用 6 种基本的数据模型:

- 两点之间可以有多条边。
- 边是有方向的,不存在无向边。
- 四元组 `<起点 VID、Edge type、边排序值 (Rank)、终点 VID>` 用于唯一标识一条边。边没有 EID。
- 四元组 `<起点 VID、Edge type、边排序值 (rank)、终点 VID>` 用于唯一标识一条边。边没有 EID。
- 一条边有且仅有一个 Edge type。
- 一条边有且仅有一个 rank。其为 int64,默认为 0。
- 一条边有且仅有一个 rank,类型为 int64,默认值为 0。

!!! 关于 rank

rank 可以用来区分 Edge type、起始点、目的点都相同的边。该值完全由用户自己指定。
读取时必须自行取得全部的 rank 值后排序过滤和拼接。
不支持诸如 `next(), pre(), head(), tail(), max(), min(), lessThan(), moreThan()` 等函数功能,也不能通过创建索引加速访问或者条件过滤。

- 标签(Tag)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Storage 服务是由 nebula-storaged 进程提供的,用户可以根据场景

- Storage interface 层

Storage 服务的最上层,定义了一系列和图相关的 API。API 请求会在这一层被翻译成一组针对[分片](#数据分片)的 KV 操作,例如:
Storage 服务的最上层,定义了一系列和图相关的 API。API 请求会在这一层被翻译成一组针对[分片](#_4)的 KV 操作,例如:

- `getNeighbors`:查询一批点的出边或者入边,返回边以及对应的属性,并且支持条件过滤。

Expand Down Expand Up @@ -70,6 +70,7 @@ Nebula Graph 使用自行开发的 KVStore,而不是其他开源 KVStore,原

- 支持多个图空间,不同图空间相互隔离,每个图空间可以设置自己的分片数和副本数。

<!--
## 数据存储格式
图存储的主要数据是点和边,Nebula Graph 将点和边的信息存储为 key,同时将点和边的属性信息存储在 value 中,以便更高效地使用属性过滤。
Expand Down Expand Up @@ -109,7 +110,7 @@ Nebula Graph 使用自行开发的 KVStore,而不是其他开源 KVStore,原
- 2.0 中取消了 1.x 中的保留字段`Timestamp`。
- 2.0 中边数据新增字段`PlaceHolder`。
- 2.0 中修改了索引的格式,以便支持范围查询。

-->
### 属性说明

Nebula Graph 使用强类型 Schema。
Expand All @@ -122,6 +123,7 @@ Nebula Graph 使用强类型 Schema。

![data partitioning](https://www-cdn.nebula-graph.com.cn/nebula-blog/DataModel02.png)

<!--
### 切边与存储放大
Nebula Graph 中逻辑上的一条边对应着硬盘上的两个键值对(key-value pair),在边的数量和属性较多时,存储放大现象较明显。边的存储方式如下图所示。
Expand All @@ -143,7 +145,7 @@ EdgeA_Out 和 EdgeA_In 以方向相反的两条边的形式存在于存储层,
如 EdgeA_Out 和 EdgeA_In 一样,Nebula Graph 冗余了存储每条边的信息,导致存储边所需的实际空间翻倍。因为边对应的 Key 占用的硬盘空间较小,但 Value 占用的空间与属性值的长度和数量成正比,所以,当边的属性值较大或数量较多时候,硬盘空间占用量会比较大。
如果对边进行操作,为了保证两个键值对的最终一致性,可以开启 [TOSS 功能](../../5.configurations-and-logs/1.configurations/3.graph-config.md),开启后,会先在正向边所在的分片进行操作,然后在反向边所在分片进行操作,最后返回结果。

-->
### 分片算法

分片策略采用**静态 Hash **的方式,即对点 VID 进行取模操作,同一个点的所有 Tag、出边和入边信息都会存储到同一个分片,这种方式极大地提升了查询效率。
Expand Down Expand Up @@ -266,10 +268,12 @@ Storage 服务基于 Raft 协议实现的分布式架构,与 HDFS 的分布式

总而言之,Storage 服务更加轻量级,精简了一些功能,架构没有 HDFS 复杂,可以有效提高小块存储的读写性能。

<!--
## 视频
用户也可以通过视频全方位了解 Nebula Graph 的存储设计。
- [nMeetup·上海 | Storage in Nebula Graph 2.0](https://www.bilibili.com/video/BV16b4y1Q77k)(24 分 29 秒)
<iframe src="//player.bilibili.com/player.html?aid=629800372&bvid=BV16b4y1Q77k&cid=317031300&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" width="720px" height="480px"> </iframe>
-->
2 changes: 1 addition & 1 deletion docs-2.0/1.introduction/3.vid.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

## VID 使用建议

- Nebula Graph 1.x 只支持 VID 类型为`INT64`,2.x 支持`INT64``FIXED_STRING(<N>)`。在`CREATE SPACE`中通过参数`vid_type`可以指定 VID 类型。
- Nebula Graph 1.x 只支持 VID 类型为`INT64`2.x 开始支持`INT64``FIXED_STRING(<N>)`。在`CREATE SPACE`中通过参数`vid_type`可以指定 VID 类型。

- 可以使用`id()`函数,指定或引用该点的 VID;

Expand Down
2 changes: 1 addition & 1 deletion docs-2.0/14.client/1.nebula-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Nebula Graph 提供多种类型客户端,便于用户连接、管理 Nebula Gr

!!! note

除 Nebula Java 之外,其他客户端暂不支持线程安全(thread-safe)。
客户端暂不支持线程安全(thread-safe)。
30 changes: 7 additions & 23 deletions docs-2.0/14.client/3.nebula-cpp-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
|Nebula Graph 版本|Nebula CPP 版本|
|:---|:---|
|{{ nebula.release }}|{{cpp.release}}|
|2.0.1|2.0.0|
|2.0.0|2.0.0|
|2.6.x|2.5.0|
|2.5.x|2.5.0|
|2.0.x|2.0.0|

## 安装 Nebula CPP

Expand All @@ -23,7 +24,7 @@
- (推荐)如果需要安装指定版本的 Nebula CPP,请使用选项`--branch`指定分支。例如安装 v{{ cpp.release }}发布版本,请执行如下命令:

```bash
$ git clone --branch v{{ cpp.release }} https://github.com/vesoft-inc/nebula-cpp.git
$ git clone --branch {{cpp.branch}} https://github.com/vesoft-inc/nebula-cpp.git
```

- 如果需要安装日常开发版本,请执行如下命令下载`master`分支的源码:
Expand Down Expand Up @@ -82,7 +83,7 @@

将 CPP 文件编译为可执行文件即可。接下来以`SessionExample.cpp`为例,介绍如何操作。

1. 使用[示例代码](https://github.com/vesoft-inc/nebula-cpp/blob/master/examples/SessionExample.cpp)创建`SessionExample.cpp`文件。
1. 使用[示例代码](https://github.com/vesoft-inc/nebula-cpp/blob/{{cpp.branch}}/examples/SessionExample.cpp)创建`SessionExample.cpp`文件。

2. 编译文件,命令如下:

Expand All @@ -102,22 +103,5 @@

### 核心代码

详细示例请参见 [SessionExample](https://github.com/vesoft-inc/nebula-cpp/blob/master/examples/SessionExample.cpp)。

```C++
nebula::init(&argc, &argv);
auto address = "192.168.xx.1:9669";
nebula::ConnectionPool pool;
pool.init({address}, nebula::Config{});
auto session = pool.getSession("root", "nebula");
auto result = session.execute("SHOW HOSTS");
std::cout << *result.data;
std::atomic_bool complete{false};
session.asyncExecute("SHOW HOSTS", [&complete](nebula::ExecutionResponse&& cbResult) {
std::cout << *cbResult.data;
complete.store(true);
});
session.release();
```
详细示例请参见 [SessionExample](https://github.com/vesoft-inc/nebula-cpp/blob/{{cpp.branch}}/examples/SessionExample.cpp)。

58 changes: 7 additions & 51 deletions docs-2.0/14.client/4.nebula-java-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
|Nebula Graph 版本|Nebula Java 版本|
|:---|:---|
|{{ nebula.release }}|{{java.release}}|
|2.0.1|2.0.0|
|2.0.0|2.0.0|
|2.6.x|2.6.1|
|2.0.x|2.0.0|
|2.0.0-rc1|2.0.0-rc1|

## 下载 Nebula Java

- (推荐)如果需要使用指定版本的 Nebula Java,请使用选项`--branch`指定分支。例如使用 v{{ java.release }}发布版本,请执行如下命令:

```bash
$ git clone --branch v{{ java.release }} https://github.com/vesoft-inc/nebula-java.git
$ git clone --branch {{java.branch}} https://github.com/vesoft-inc/nebula-java.git
```

- 如果需要安装日常开发版本,请执行如下命令下载`master`分支的源码:
Expand All @@ -39,13 +39,13 @@

!!! note

`2.0.0-SNAPSHOT`为日常研发版本,可能存在未知问题,建议使用 release 版本号替换`2.0.0-SNAPSHOT`
`3.0.0-SNAPSHOT`为日常研发版本,可能存在未知问题,建议使用 release 版本号替换`3.0.0-SNAPSHOT`

```bash
<dependency>
<groupId>com.vesoft</groupId>
<artifactId>client</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>3.0.0-SNAPSHOT</version>
</dependency>
```

Expand All @@ -64,49 +64,5 @@

### 核心代码

详细示例请参见 [GraphClientExample](https://github.com/vesoft-inc/nebula-java/blob/master/examples/src/main/java/com/vesoft/nebula/examples/GraphClientExample.java)。

```java
NebulaPool pool = new NebulaPool();
Session session = null;
try {
NebulaPoolConfig nebulaPoolConfig = new NebulaPoolConfig();
nebulaPoolConfig.setMaxConnSize(100);
List<HostAddress> addresses = Arrays.asList(new HostAddress("192.168.xx.1", 9669),
new HostAddress("192.168.xx.2", 9670));
pool.init(addresses, nebulaPoolConfig);
session = pool.getSession("root", "nebula", false);
//create space
String space = "test";
String createSpace = "CREATE SPACE IF NOT EXISTS " + space + " (partition_num=15, replica_factor=1, vid_type=fixed_string(30)); ";
ResultSet resp = session.execute(createSpace);
//create schema
String createSchema = "USE " + space + "; CREATE TAG IF NOT EXISTS person(name string, age int);"
+ "CREATE EDGE IF NOT EXISTS like(likeness double)";
ResultSet resp = session.execute(createSchema);
//insert vertex
String insertVertexes = "INSERT VERTEX person(name, age) VALUES " + "'Bob':('Bob', 10), "
+ "'Lily':('Lily', 9), " + "'Tom':('Tom', 10), " + "'Jerry':('Jerry', 13), "
+ "'John':('John', 11);";
ResultSet resp = session.execute(insertVertexes);
// inert edge
String insertEdges = "INSERT EDGE like(likeness) VALUES " + "'Bob'->'Lily':(80.0), "
+ "'Bob'->'Tom':(70.0), " + "'Lily'->'Jerry':(84.0), " + "'Tom'->'Jerry':(68.3), "
+ "'Bob'->'John':(97.2);";
ResultSet resp = session.execute(insertEdges);
// query
String query = "GO FROM \"Bob\" OVER like " + "YIELD properties($$).name, properties($$).age, properties(edge).likeness";
ResultSet resp = session.execute(query);
printResult(resp);
}finally {
if (session != null) {
session.release();
}
pool.close();
}
```
详细示例请参见 [GraphClientExample](https://github.com/vesoft-inc/nebula-java/blob/{{java.branch}}/examples/src/main/java/com/vesoft/nebula/examples/GraphClientExample.java)。

73 changes: 6 additions & 67 deletions docs-2.0/14.client/5.nebula-python-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@

## 前提条件

已安装 Python,版本为 3.5 及以上。
已安装 Python,版本为 3.6 及以上。

## 版本对照表

|Nebula Graph 版本|Nebula Python 版本|
|:---|:---|
|{{ nebula.release }}|{{python.release}}|
|2.0.1|2.0.0|
|2.0.0|2.0.0|
|2.6.x|2.6.0|
|2.0.x|2.0.0|
|2.0.0-rc1|2.0.0rc1|

## 安装 Nebula Python

### pip 安装

```bash
$ pip install nebula2-python==<version>
$ pip install nebula3-python==<version>
```

### 克隆源码安装
Expand All @@ -30,7 +30,7 @@ $ pip install nebula2-python==<version>
- (推荐)如果需要安装指定版本的 Nebula Python,请使用选项`--branch`指定分支。例如安装 v{{ python.release }}发布版本,请执行如下命令:

```bash
$ git clone --branch v{{ python.release }} https://github.com/vesoft-inc/nebula-python.git
$ git clone --branch {{python.branch}} https://github.com/vesoft-inc/nebula-python.git
```

- 如果需要安装日常开发版本,请执行如下命令下载`master`分支的源码:
Expand All @@ -53,66 +53,5 @@ $ pip install nebula2-python==<version>

## 核心代码

详细示例请参见 [Example](https://github.com/vesoft-inc/nebula-python/tree/master/example)。
详细示例请参见 [Example](https://github.com/vesoft-inc/nebula-python/tree/{{python.branch}}/example)。

### 连接 Graph 服务

```python
# 定义配置
config = Config()
config.max_connection_pool_size = 10
# 初始化连接池
connection_pool = ConnectionPool()
# 如果给定的服务器正常,则返回 true,否则返回 false。
ok = connection_pool.init([('192.168.xx.1', 9669)], config)
# 方法 1:控制连接自行释放。
# 从连接池中获取会话
session = connection_pool.get_session('root', 'nebula')
# 选择图空间
session.execute('USE basketballplayer')
# 执行查看 TAG 命令
result = session.execute('SHOW TAGS')
print(result)
# 释放会话
session.release()
# 方法 2:使用 session_context,会话将被自动释放。
with connection_pool.session_context('root', 'nebula') as session:
session.execute('USE basketballplayer;')
result = session.execute('SHOW TAGS;')
print(result)
# 关闭连接池
connection_pool.close()
```

### 连接 Storage 服务

```python
# 设置所有 Meta 服务地址
meta_cache = MetaCache([('192.168.xx.1', 9559),
('192.168.xx.2', 9559),
('192.168.xx.3', 9559)],
50000)
graph_storage_client = GraphStorageClient(meta_cache)
resp = graph_storage_client.scan_vertex(
space_name='ScanSpace',
tag_name='person')
while resp.has_next():
result = resp.next()
for vertex_data in result:
print(vertex_data)
resp = graph_storage_client.scan_edge(
space_name='ScanSpace',
edge_name='friend')
while resp.has_next():
result = resp.next()
for edge_data in result:
print(edge_data)
```
Loading

0 comments on commit 12b5645

Please sign in to comment.