Skip to content

ALTER EDGE

ALTER EDGE <edge_type_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 EDGE alters the structure of an edge type with the given name in a graph space. You must have the ALTER privilege for the graph space. To alter an edge type 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 INT or TIMESTAMP type properties.

Before you alter properties for an edge type, 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.

Edge type name

edge_type_name specifies the edge type name that you want to alter. You can alter only one edge type in one statement. Before you alter an edge type, make sure that the edge type exists in the graph space. If the edge type does not exist, an error occurs when you alter it.

Example

nebula> CREATE EDGE e1(p1 string, p2 int);
nebula> ALTER EDGE e1 ADD (p3 int, p4 string);
nebula> ALTER EDGE e1 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 EDGE to confirm that the edge 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.


Last update: March 19, 2021
Back to top