Skip to content

Commit

Permalink
Support show create tag/edge xxx, show create space xxx SQL (#496)
Browse files Browse the repository at this point in the history
* improve unreserved keywords feature

support time to live

alter tag/edge drop column, and the column to be delete is as TTL column

address dangleptr's comment

* address laura-ding's comments

* rebase master
  • Loading branch information
ayyt authored and dutor committed Aug 15, 2019
1 parent b3386e6 commit d8c7fd8
Show file tree
Hide file tree
Showing 14 changed files with 730 additions and 101 deletions.
77 changes: 62 additions & 15 deletions docs/nGQL-tutorial.md
Expand Up @@ -50,13 +50,13 @@ ADD HOSTS 192.168.8.5:65500

```
SHOW HOSTS
=============================
| Ip | Port | Status |
=============================
| 192.168.8.5 | 65500 | online |
-----------------------
=================================
| Ip | Port | Status |
=================================
| 192.168.8.5 | 65500 | online |
---------------------------------
| 192.168.8.1 | 65500 | offline |
-----------------------
---------------------------------
```

* Remove hosts
Expand All @@ -79,9 +79,9 @@ REMOVE HOSTS $storage_ip1:$storage_port1, $storage_ip2:$storage_port2,...

Graph spaces are physically isolated like the database in MySQL.

| | CREATE | DROP | USE | DESCRIBE | SHOW |
|---| --- | --- | ----- | -------- | ---- |
| SPACE |||| v0.2 ||
| | CREATE | DROP | USE | DESCRIBE | SHOW | SHOW CREATE |
|---| --- | --- | ----- | -------- | ---- | ----------- |
| SPACE |||| v0.2 || v0.2 |

Create space with CREATE, drop space with DROP, choose which space to use with USE, list available spaces with SHOW. DESCRIBE will be released in v0.2.

Expand All @@ -92,12 +92,21 @@ Following are some examples:
```
SHOW SPACES
================
| Name |
| Name |
================
| myspace_test |
----------------
```

```
SHOW CREATE SPACES myspace_test
====================================================================================
| Space | Create Space |
====================================================================================
| myspace_test | CREATE SPACE myspace_test (partition_num = 1, replica_factor = 1) |
------------------------------------------------------------------------------------
```

* Drop a space

```
Expand All @@ -123,12 +132,12 @@ USE myspace_test

Schema is used to manage the properties of vertices and edges (name and type of each field). In Nebula, a vertex can be labeled by multiple tags.

| | CREATE | DROP | ALTER | DESCRIBE | SHOW | TTL | LOAD | DUMP |
|:-: | :-: | :-: |:-: | :-: | :-: | :-: |:-: | :-: |
|TAG || v0.2 | v0.2 ||| v0.3 | v0.2 | v0.3 |
|EDGE||v0.2 | v0.2 |||v0.3 | v0.2 | v0.3 |
| | CREATE | DROP | ALTER | DESCRIBE | SHOW | TTL | LOAD | DUMP | SHOW CREATE |
|:-: | :-: | :-: |:-: | :-: | :-: | :-: |:-: | :-: | :-: |
|TAG || v0.2 | v0.2 ||| v0.3 | v0.2 | v0.3 | v0.2 |
|EDGE||v0.2 | v0.2 |||v0.3 | v0.2 | v0.3 | v0.2 |

You can use CREATE, DROP, ALTER, DESCRIBE to create, drop, alter, view a schema.
You can use CREATE, DROP, ALTER, DESCRIBE, SHOW CREATE to create, drop, alter, view a schema.
Following are some examples:

```
Expand All @@ -137,6 +146,25 @@ CREATE TAG player(name string, age int);

```
DESCRIBE TAG player;
==================
| Field | Type |
==================
| name | string |
------------------
| age | int |
------------------
```

```
SHOW CREATE TAG player;
==========================================================================================
| Tag | Create Tag |
==========================================================================================
| player | CREATE TAG player (
name string,
age int
) ttl_duration = 0, ttl_col = "" |
------------------------------------------------------------------------------------------
```

```
Expand All @@ -153,6 +181,25 @@ CREATE EDGE serve (start_year int, end_year int);

```
DESCRIBE EDGE serve;
=====================
| Field | Type |
=====================
| start_year | int |
---------------------
| end_year | int |
---------------------
```

```
SHOW CREATE EDGE serve;
=================================================================================================
| Edge | Create Edge |
=================================================================================================
| serve | CREATE EDGE serve (
start_year int,
end_year int
) ttl_duration = 0, ttl_col = "" |
-------------------------------------------------------------------------------------------------
```

```
Expand Down
1 change: 0 additions & 1 deletion src/graph/AlterTagExecutor.cpp
Expand Up @@ -48,7 +48,6 @@ void AlterTagExecutor::execute() {
auto *name = sentence_->name();
auto spaceId = ectx()->rctx()->session()->space();


auto future = mc->alterTagSchema(spaceId, *name, std::move(options_), std::move(schemaProp_));
auto *runner = ectx()->rctx()->runner();
auto cb = [this] (auto &&resp) {
Expand Down
6 changes: 3 additions & 3 deletions src/graph/DescribeSpaceExecutor.cpp
@@ -1,7 +1,7 @@
/* Copyright (c) 2019 - present, VE Software Inc. All rights reserved
/* Copyright (c) 2019 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License
* (found in the LICENSE.Apache file in the root directory)
* This source code is licensed under Apache 2.0 License,
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
*/

#include "base/Base.h"
Expand Down
6 changes: 3 additions & 3 deletions src/graph/DescribeSpaceExecutor.h
@@ -1,7 +1,7 @@
/* Copyright (c) 2019 - present, VE Software Inc. All rights reserved
/* Copyright (c) 2019 vesoft inc. All rights reserved.
*
* This source code is licensed under Apache 2.0 License
* (found in the LICENSE.Apache file in the root directory)
* This source code is licensed under Apache 2.0 License,
* attached with Common Clause Condition 1.0, found in the LICENSES directory.
*/

#ifndef GRAPH_DESCRIBESPACEEXECUTOR_H_
Expand Down

0 comments on commit d8c7fd8

Please sign in to comment.