Skip to content

DROP TAG

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 will become a vertex without tag.
  • 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.

Prerequisites

  • Running the DROP TAG statement 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 (-1005)]: Conflict!) will be returned when you run the DROP TAG statement. To drop an index, see DROP INDEX.

Syntax

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.

Example

nebula> CREATE TAG IF NOT EXISTS test(p1 string, p2 int);
nebula> DROP TAG test;

Last update: March 13, 2023