basic_info_withTTL

CREATE TYPE IF NOT EXISTS cycling.basic_info ( 
  birthday timestamp, 
  nationality text, 
  height text,
  weight text
);
DESC TYPE cycling.basic_info;
DROP TYPE IF EXISTS cycling.basic_info;
CREATE TYPE IF NOT EXISTS cycling.basic_info_expire (
  birthday timestamp,
  nationality text,
  height text,
  weight text,
  next_race text
);
DESC TYPE cycling.basic_info_expire;
DROP TYPE IF EXISTS cycling.basic_info_expire;
CREATE TABLE IF NOT EXISTS cycling.basic_info_ttl_expire (
  id UUID PRIMARY KEY,
  lastname text,
  basics basic_info_expire
);
INSERT INTO cycling.basic_info_TTL_expire (
  id, lastname, basics
) VALUES (
  e7ae5cf3-d358-4d99-b900-85902fda9bb0,
  'FRAME',
  {
    birthday : '1993-06-18',
    nationality : 'New Zealand',
    weight : '175',
    height : '72',
    next_race : 'Amgen Tour of California'
  }
)
USING TIMESTAMP 100 AND TTL 10000;
UPDATE cycling.basic_info_TTL_expire 
USING TTL 100 
SET basics.next_race = 'Tour de France' 
WHERE id = e7ae5cf3-d358-4d99-b900-85902fda9bb0;
SELECT *
FROM cycling.basic_info_ttl_expire;
SELECT WRITETIME(basics), TTL(basics)
FROM cycling.basic_info_TTL_expire 
WHERE id = e7ae5cf3-d358-4d99-b900-85902fda9bb0;

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries. Kubernetes is the registered trademark of the Linux Foundation.

General Inquiries: +1 (650) 389-6000, info@datastax.com