ALTER TAG¶
ALTER TAG <tag_name>
<alter_definition> [, alter_definition] ...]
[ttl_definition [, ttl_definition] ... ]
alter_definition:
| ADD (prop_name data_type)
| DROP (prop_name)
| CHANGE (prop_name data_type)
ttl_definition:
TTL_DURATION = ttl_duration, TTL_COL = prop_name
ALTER TAG
alters the structure of a tag with the given name in a graph space. You must have the ALTER
privilege for the graph space. To alter a tag in a specific graph space, you must use the graph space first.
You can add or drop properties, change the data type of an existing property. You can also set TTL (Time-To-Live) for a property, or change the TTL duration. TTL_COL
only supports the properties whose values are of the INT
or the TIMESTAMP
type.
Before you alter properties for a tag, make sure that the properties are not indexed. If the properties contain any indexes, a conflict error occurs when you alter them.
For information about index, see Index.
Multiple ADD
, DROP
, and CHANGE
clauses are permitted in a single ALTER
statement, separated by commas.
Tag name¶
tag_name
: Specifies the tag name that you want to alter. You can alter only one tag in one statement. Before you alter a tag, make sure that the tag exists in the graph space. If the tag does not exist, an error occurs when you alter it.
Example¶
nebula> CREATE TAG t1 (p1 string, p2 int);
nebula> ALTER TAG t1 ADD (p3 int, p4 string);
nebula> ALTER TAG t1 TTL_DURATION = 2, TTL_COL = "p2";
Implementation of the operation¶
Nebula Graph implements the alteration asynchronously in the next heartbeat cycle. Before the process finishes, the alteration does not take effect. To make sure the alteration is successful, take the following approaches:
- Use
DESCRIBE TAG
to confirm that the tag information is updated. If it is not, wait a few seconds and try again. - Wait for two heartbeat cycles, i.e., 20 seconds.
To change the heartbeat interval, modify the heartbeat_interval_secs
parameter in the configuration files for all services.