仅学习cassandra,有没有一种方法可以使用CQL插入UUID,即
create table stuff (uid uuid primary key, name varchar);
insert into stuff (name) values('my name'); // fails
insert into stuff (uid, name) values(1, 'my name'); // fails
你可以做类似的事情吗
insert into stuff (uid, name) values(nextuid(), 'my name');
您可以使用now()函数使用时间uuid(类型1 UUID),例如
insert into stuff (uid, name) values(now(), 'my name');
与uid或timeuuid一起使用。它生成“保证的唯一” UID值,该值还包含时间戳,因此可以按时间排序。
但是,类型4 UUID没有这样的功能。
更新:本说明与Cassandra的旧版本有关。有关较新的版本,请参见下文。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句