nebula-graphnebula-studio

execute command in nebula studio to create vertex item in database


as mentioned in nebula documentation here :

https://docs.nebula-graph.io/1.2.0/manual-EN/2.query-language/1.data-types/data-types/

nebula documentation create vertex datetime timestamp record in graph database

nebula> INSERT VERTEX school(name, create_time) VALUES hash("new"):("new", "1985-10-01 08:00:00")

error is:

-1005:Storage Error: The data type does not meet the requirements. Use the correct type of data.

and this:

-1005:Wrong vertex id type: hash("new")


Solution

  • Please be noted you are referring to NebulaGraph v1.x documentation, in NebulaGraph V1, the vid only supports int64, but now, it supports(since 2.x) string format. And you could define this during the creation of the graph space:

    CREATE SPACE [IF NOT EXISTS] <graph_space_name> (
        [partition_num = <partition_number>,]
        [replica_factor = <replica_number>,]
        vid_type = {FIXED_STRING(<N>) | INT[64]}
        )
        [COMMENT = '<comment>'];
    

    for instance if you created space like this:

    CREATE SPACE IF NOT EXISTS my_space_2 (partition_num=15, replica_factor=1, vid_type=FIXED_STRING(30));
    

    The vid of "new" is valid and no hash is needed.

    ref: