سؤال

I am new to cassandra. I want to know how can i insert system date and time through CLI (command line interface) for perticular row.

DateType and TiemUUIDType are just data types for this purpose so how can i use this two data types and insert the date and time for perticular UUID through Internal/ CLI type.

Thanks in advance.

هل كانت مفيدة؟

المحلول

To enter a timeuuid corresponding to now, use the timeuuid() function, e.g. (taken from this example):

CREATE COLUMN FAMILY blog_entry
  WITH comparator = TimeUUIDType
  AND key_validation_class=UTF8Type
  AND default_validation_class = UTF8Type;

SET blog_entry['yomama'][timeuuid()] = 'I love my new shoes!';

To enter a timestamp into a datetime function use the unix timestamp, see the following example (taken from a related question), where we insert a unix timestamp into a DateType column:

set test['userID']['dob']=567999912112;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top