Inserting a hard-coded UUID via CQLsh (Cassandra)

前端 未结 2 573
再見小時候
再見小時候 2020-12-17 07:16

Would like to populate some static test data via a CQLsh script.

This doesn\'t work: (device_id is UUID)

insert into devices (device_id, geohash,nam         


        
相关标签:
2条回答
  • 2020-12-17 08:02

    Alternate: Use uuid() function. i have tested this in DevCenter 1.6.0.

    insert into CHANGE_LOG (someid, modifieddatetime, snum, gnum, source) values ( uuid() , '2000-12-12 08:00:00', '21A', '', 'system');

    0 讨论(0)
  • 2020-12-17 08:10

    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'});
    
    0 讨论(0)
提交回复
热议问题