USE¶
USE
specifies a graph space as the current working graph space for subsequent queries.
Prerequisites¶
Running the USE
statement requires some privileges for the graph space. Otherwise, NebulaGraph throws an error.
Syntax¶
USE <graph_space_name>;
Examples¶
# The following example creates two sample spaces.
nebula> CREATE SPACE IF NOT EXISTS space1 (vid_type=FIXED_STRING(30));
nebula> CREATE SPACE IF NOT EXISTS space2 (vid_type=FIXED_STRING(30));
# The following example specifies space1 as the current working graph space.
nebula> USE space1;
# The following example specifies space2 as the current working graph space. Hereafter, you cannot read any data from space1, because these vertices and edges being traversed have no relevance with space1.
nebula> USE space2;
Caution
You cannot use two graph spaces in one statement.
Different from Fabric Cypher, graph spaces in NebulaGraph are fully isolated from each other. Making a graph space as the working graph space prevents you from accessing other spaces. The only way to traverse in a new graph space is to switch by the USE
statement. In Fabric Cypher, you can use two graph spaces in one statement (using the USE + CALL
syntax). But in NebulaGraph, you can only use one graph space in one statement.
Last update:
February 1, 2023