DROP TAG drops a tag with the given name in the current working graph space.
A vertex can have one or more tags.
- If a vertex has only one tag, the vertex CANNOT be accessed after you drop it. But its edges are available. The vertex will be dropped in the next compaction.
- If a vertex has multiple tags, the vertex is still accessible after you drop one of them. But all the properties defined by this dropped tag CANNOT be accessed.
This operation only deletes the Schema data. All the files or directories in the disk will not be deleted directly until the next compaction.
- Running the
DROP TAGstatement requires some privileges for the graph space. Otherwise, NebulaGraph throws an error.
- Before you drop a tag, make sure that the tag does not have any indexes. Otherwise, the conflict error (
[ERROR (-8)]: Conflict!) will be returned when you run the
DROP TAGstatement. To drop an index, see DROP INDEX.
DROP TAG [IF EXISTS] <tag_name>;
IF NOT EXISTS: Detects if the tag that you want to drop exists. Only when it exists will it be dropped.
tag_name: Specifies the tag name that you want to drop. You can drop only one tag in one statement.
nebula> CREATE TAG IF NOT EXISTS test(p1 string, p2 int); nebula> DROP TAG test;
In nGQL, there is no such statement to drop a certain tag of a vertex with the given name.
- In openCypher, you can use the statement
REMOVE v:LABELto drop the tag
LABLEof the vertex
- In nGQL, after
INSERT VERTEX, you can add a
TAGon the vertex. But there is no way to drop the
We recommend you to add a field to identify the logical deletion in the schema. For example, add
removed to the schema of each tag.
Last update: March 13, 2023