How to auto generate uuid in cassandra CQL 3 command line

后端 未结 4 1496
名媛妹妹
名媛妹妹 2020-12-25 11:14

Just learning cassandra, is there a way to insert a UUID using CQL, ie

create table stuff (uid uuid primary key, name varchar);
insert into stuff (name) valu         


        
4条回答
  •  -上瘾入骨i
    2020-12-25 11:26

    As of Cassandra 2.0.7 you can just use uuid(), which generates a random type 4 UUID:

    INSERT INTO users(uid, name) VALUES(uuid(), 'my name');
    

提交回复
热议问题