Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support show create tag/edge xxx, show create space xxx SQL #439

Closed
ayyt opened this issue May 27, 2019 · 7 comments · Fixed by #496
Closed

Support show create tag/edge xxx, show create space xxx SQL #439

ayyt opened this issue May 27, 2019 · 7 comments · Fixed by #496
Assignees
Milestone

Comments

@ayyt
Copy link
Contributor

ayyt commented May 27, 2019

Current, desc tag/edge, not display table-level attributes, only display column attributes.
so, use show create tag/edge SQL, to display column attributes and table-level attributes.
e.g. comment,ttl_duration, ttl_col, character set, engines.

@ayyt ayyt changed the title Support show create tag/edge SQL Support show create tag/edge xxx, show create space xxx SQL May 27, 2019
@sherman-the-tank sherman-the-tank added this to the v1_beta_release milestone May 30, 2019
@ayyt
Copy link
Contributor Author

ayyt commented May 30, 2019

Does anyone claim this issue? If not, I will try.

@dangleptr
Copy link
Contributor

Go ahead!!

@ayyt
Copy link
Contributor Author

ayyt commented Jun 3, 2019

Because use this feature to display the TTL attribute, So first implement this function.
An example is as follows:

create table t(a varchar(10));

gbase> show create table t;
+-------+---------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                        |
+-------+---------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE "t" (
  "a" varchar(10) DEFAULT NULL
) ENGINE=EXPRESS DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |
+-------+---------------------------------------------------------------------------------------------------------------------+
1 row in set (Elapsed: 00:00:00.00)


gbase> alter table t add column b int;
Query OK, 0 rows affected (Elapsed: 00:00:00.03)
Records: 0  Duplicates: 0  Warnings: 0

gbase> show create table t;
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                    |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE "t" (
  "a" varchar(10) DEFAULT NULL,
  "b" int(11) DEFAULT NULL
) ENGINE=EXPRESS DEFAULT CHARSET=utf8 TABLESPACE='sys_tablespace' |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (Elapsed: 00:00:00.00)


gbase> desc t;
+-------+-------------+------+-----+---------+-------+
| Field | Type        | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+-------+
| a     | varchar(10) | YES  |     | NULL    |       |
| b     | int(11)     | YES  |     | NULL    |       |
+-------+-------------+------+-----+---------+-------+
2 rows in set (Elapsed: 00:00:00.00)

@ayyt
Copy link
Contributor Author

ayyt commented Jun 4, 2019

Execution result in nebula:

show create tag t;
+-------+---------------------------------------------------------------------------------------------------------------------+
| Tag | Create Tag                                                                                                        |
+-------+---------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TAG t (
  a int,
  b string
) ttl_duration = 100, ttl_col = a  |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------+

show create edge e;
+-------+---------------------------------------------------------------------------------------------------------------------+
| Edge | Create Edge                                                                                                        |
+-------+---------------------------------------------------------------------------------------------------------------------+
| e     | CREATE EDGE t (
  a int,
  b string
) ttl_duration = 100, ttl_col = a  |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------+

show create space s;
+-------+---------------------------------------------------------------------------------------------------------------------+
| Space | Create Space                                                                                                        |
+-------+---------------------------------------------------------------------------------------------------------------------+
| s    | CREATE SPACE s (partition_num = 9,replica_factor = 1)   |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------+

@sherman-the-tank
Copy link
Member

I would suggest to output only one column

@ayyt
Copy link
Contributor Author

ayyt commented Jun 6, 2019

@sherman-the-tank

In mysql, output two columns, first column is object(database,table), second column is create object(create database,create table).

mysql> show create database test;
+----------+-----------------------------------------------------------------+
| Database | Create Database                                                 |
+----------+-----------------------------------------------------------------+
| test     | CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ |
+----------+-----------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show create table t;
+-------+--------------------------------------------------------------------------------------+
| Table | Create Table                                                                         |
+-------+--------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `a` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+--------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Of course, it is ok to display only one column

@sherman-the-tank
Copy link
Member

@steppenwolfyuetong Let's follow mysql then ^_^

@ayyt ayyt mentioned this issue Jun 17, 2019
yixinglu added a commit to yixinglu/nebula that referenced this issue Mar 21, 2022
Co-authored-by: Yee <[email protected]>
Co-authored-by: Sophie <[email protected]>

Co-authored-by: Alex Xing <[email protected]>
Co-authored-by: Yee <[email protected]>
Co-authored-by: Sophie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants