Skip to content

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, Nebula Graph throws an error.

Syntax

USE <graph_space_name>;

Examples

# The following example specifies space1 as the current working graph space.
nebula> USE space1;

# The following example traverses in space1.
nebula> GO FROM 1 OVER edge1;

# The following example specifies space2 as the current working graph space.
nebula> USE space2;

# The following example traverses in space2. Hereafter, you cannot read any data from space1, because these vertices and edges being traversed have no relevance with space1.
nebula> GO FROM 2 OVER edge2;

Caution

You cannot use two graph spaces in one statement.

Different from Fabric Cypher, graph spaces in Nebula Graph 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 Nebula Graph, you can only use one graph space in one statement.


Last update: August 13, 2021
Back to top