本文介绍了通过CQLsh(Cassandra)插入硬编码的UUID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
希望通过CQLsh脚本填充一些静态测试数据。
Would like to populate some static test data via a CQLsh script.
这不起作用:(device_id是UUID)
This doesn't work: (device_id is UUID)
insert into devices (device_id, geohash,name, external_identifier, measures, tags)
values ('c37d661d-7e61-49ea-96a5-68c34e83db3a','9q9p3yyrn1', 'Acme1', '936', {'aparPower','actPower','actEnergy'},{'make':'Acme'});
我似乎找不到任何CQL函数转换为正确的类型。我需要从python脚本这样做吗?
I can't seem to find any CQL function to convert to proper type. Do I need to do this from a python script?
谢谢,
Chris
Thanks,Chris
推荐答案
你不应该在UUID周围加上引号来停止它被解释为字符串
You shouldn't put the quotes around the UUID to stop it being interpreted as a string i.e.
insert into devices (device_id, geohash,name, external_identifier, measures, tags)
values
(c37d661d-7e61-49ea-96a5-68c34e83db3a,'9q9p3yyrn1', 'Acme1', '936', {'aparPower','actPower','actEnergy'},{'make':'Acme'});
这篇关于通过CQLsh(Cassandra)插入硬编码的UUID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!