SlideShare a Scribd company logo
1 of 26
Download to read offline
CQL In Cassandra 1.0 (and beyond)

       Big Data DC Meetup #5
          October 17, 2011

                Eric Evans
            eric@acunu.com
          @jericevans, @acunu
●   Overview, history, motivation
●   Changes in CQL 2.0 (Cassandra 1.0)
●   Coming soon (?)
●   Drivers status
What?
●   Cassandra Query Language
    ●   aka CQL
    ●   aka /ˈsēkwəl/
●   Exactly like SQL (except where it's not)
●   Introduced in Cassandra 0.8.0
●   Ready for production use
SQL? Almost.

–- Inserts or updates
INSERT INTO Standard1 (KEY, col0, col1)
VALUES (key, value0, value1)
                   vs.
–- Inserts or updates
UPDATE Standard1
SET col0=value0, col1=value1 WHERE KEY=key
SQL? Almost.
–- Get columns for a row
SELECT col0,col1 FROM Standard1 WHERE KEY=key

–- Range of columns for a row
SELECT col0..colN
    FROM Standard1 WHERE KEY=key

–- First 10 results from a range of columns
SELECT FIRST 10 col0..colN
    FROM Standard1 WHERE KEY=key

–- Invert the sorting of results
SELECT REVERSED col0..colN
    FROM Standard1 WHERE KEY=key
Why?
Interface Instability
(Un)ease of use
Column col = new Column(ByteBuffer.wrap(“name”.getBytes()));
col.setValue(ByteBuffer.wrap(“value”.getBytes()));
col.setTimestamp(System.currentTimeMillis());

ColumnOrSuperColumn cosc = new ColumnOrSuperColumn();
cosc.setColumn(col);
Mutation mutation = new Mutation();
Mutation.setColumnOrSuperColumn(cosc);
List mutations = new ArrayList<Mutation>();
mutations.add(mutation);
Map mutations_map = new HashMap<ByteBuffer, Map<String, List<Mutation>>>();
Map cf_map = new HashMap<String, List<Mutation>>();
cf_map.set(“Standard1”, mutations);
mutations.put(ByteBuffer.wrap(“key”.getBytes()), cf_map)
CQL
INSERT INTO Standard1 (KEY, col0)
    VALUES (key, value0)
Why? How about...
●   Better stability guarantees
●   Easier to use (you already know it)
●   Better code readability / maintainability
Why? How about...
●   Better stability guarantees
●   Easier to use (you already know it)
●   Better code readability / maintainability
●   Irritates the NoSQL purists
Why? How about...
●   Better stability guarantees
●   Easier to use (you already know it)
●   Better code readability / maintainability
●   Irritates the NoSQL purists
●   (Still )irritates the SQL purists
CQL 2.0
Wait, 2.0? You call that stable?
Yes yes, but...
 ●   We had a few FUBARs in the first pass
 ●   Not the norm, honest
 ●   It's a mulligan
 ●   Look, cats!
Changed in 2.0
●   SELECT count(...) FROM now returns row,
    not column count
●   Terms / Types
    ●   bytea became blob
    ●   int became 4-bytes (was arbitrary precision)
    ●   date became timestamp
Also new (but not breaking)
●   Named keys (virtual columns)
●   Counters
●   Complete DDL support
●   Timestamps and TTLs
Named Keys
–- An unnamed key uses the KEY keyword
CREATE TABLE Standard1
    (KEY text PRIMARY KEY)
–- But you can also name one like so...
CREATE TABLE Standard1
    (username text PRIMARY KEY)
–- The name will also be used in results!
SELECT email FROM Standard1
    WHERE username = 'jericevans'
Counters
–- Counter increment
UPDATE Standard1
SET acount = acount + 1 WHERE KEY = key
–- Counter decrement
UPDATE Standard1
SET acount = acount - 1 WHERE KEY = key
–- 1 not enough? Go nuts.
UPDATE Standard1
SET acount = acount + 9 WHERE KEY = key
Timestamps and TTLs

–- Inserts or updates
UPDATE CFam USING TIMESTAMP 131851901600
SET col0=value0, col1=value1 WHERE KEY=key
–- Inserts or updates
UPDATE CFam USING TTL 86400
SET col0=value0, col1=value1 WHERE KEY=key
Coming Soon(ish)
Roadmap
●   Prepared statements (CASSANDRA-2475)
●   Compound columns (CASSANDRA-2474)
●   Custom transport / protocol (CASSANDRA-2478)
●   Performance testing (CASSANDRA-2268)
●   Schema introspection (CASSANDRA-2477)
●   Multiget support (CASSANDRA-3069)
Drivers
Drivers
●   Hosted on Apache Extras (Google Code)
●   Tagged cassandra and cql
●   Licensed using Apache License 2.0
●   Conforming to a standard for database
    connectivity (if applicable)
●   Coming soon, automated testing and
    acceptance criteria
Drivers
Driver                           Platform                 Status
cassandra-jdbc                   Java                     Good
cassandra-dbapi2                 Python                   Good
cassandra-ruby                   Ruby                     New
cassandra-pdo                    PHP                      New
cassandra-node                   Node.js                  Good

http://code.google.com/a/apache-extras.org/hosting/search?q=label%3aCassandra
The End

More Related Content

What's hot

Владимир Перепелица "Модули"
Владимир Перепелица "Модули"Владимир Перепелица "Модули"
Владимир Перепелица "Модули"
Media Gorod
 
Ruby/rails performance and profiling
Ruby/rails performance and profilingRuby/rails performance and profiling
Ruby/rails performance and profiling
Danny Guinther
 

What's hot (20)

Владимир Перепелица "Модули"
Владимир Перепелица "Модули"Владимир Перепелица "Модули"
Владимир Перепелица "Модули"
 
Adopting GraalVM - Scala eXchange London 2018
Adopting GraalVM - Scala eXchange London 2018Adopting GraalVM - Scala eXchange London 2018
Adopting GraalVM - Scala eXchange London 2018
 
MongoDB as Message Queue
MongoDB as Message QueueMongoDB as Message Queue
MongoDB as Message Queue
 
Мониторинг. Опять, rootconf 2016
Мониторинг. Опять, rootconf 2016Мониторинг. Опять, rootconf 2016
Мониторинг. Опять, rootconf 2016
 
Kafka monitoring and metrics
Kafka monitoring and metricsKafka monitoring and metrics
Kafka monitoring and metrics
 
Metrics: where and how
Metrics: where and howMetrics: where and how
Metrics: where and how
 
OSMC 2014: Monitoring VoIP Systems | Sebastian Damm
OSMC 2014: Monitoring VoIP Systems | Sebastian DammOSMC 2014: Monitoring VoIP Systems | Sebastian Damm
OSMC 2014: Monitoring VoIP Systems | Sebastian Damm
 
Tales Of The Black Knight - Keeping EverythingMe running
Tales Of The Black Knight - Keeping EverythingMe runningTales Of The Black Knight - Keeping EverythingMe running
Tales Of The Black Knight - Keeping EverythingMe running
 
tdc2012
tdc2012tdc2012
tdc2012
 
Kotlin Coroutines and Rx
Kotlin Coroutines and RxKotlin Coroutines and Rx
Kotlin Coroutines and Rx
 
Java 어플리케이션 성능튜닝 Part1
Java 어플리케이션 성능튜닝 Part1Java 어플리케이션 성능튜닝 Part1
Java 어플리케이션 성능튜닝 Part1
 
Perl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one linersPerl - laziness, impatience, hubris, and one liners
Perl - laziness, impatience, hubris, and one liners
 
Tuning Solr for Logs
Tuning Solr for LogsTuning Solr for Logs
Tuning Solr for Logs
 
Ruby/rails performance and profiling
Ruby/rails performance and profilingRuby/rails performance and profiling
Ruby/rails performance and profiling
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra Explained
 
Object Storage with Gluster
Object Storage with GlusterObject Storage with Gluster
Object Storage with Gluster
 
Tale of Kafka Consumer for Spark Streaming
Tale of Kafka Consumer for Spark StreamingTale of Kafka Consumer for Spark Streaming
Tale of Kafka Consumer for Spark Streaming
 
DevOps in PHP environment
DevOps in PHP environmentDevOps in PHP environment
DevOps in PHP environment
 
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
 
Prometheus Storage
Prometheus StoragePrometheus Storage
Prometheus Storage
 

Viewers also liked

Time Series Data with Apache Cassandra (ApacheCon EU 2014)
Time Series Data with Apache Cassandra (ApacheCon EU 2014)Time Series Data with Apache Cassandra (ApacheCon EU 2014)
Time Series Data with Apache Cassandra (ApacheCon EU 2014)
Eric Evans
 
Cassandra by Example: Data Modelling with CQL3
Cassandra by Example:  Data Modelling with CQL3Cassandra by Example:  Data Modelling with CQL3
Cassandra by Example: Data Modelling with CQL3
Eric Evans
 
Virtual Nodes: Rethinking Topology in Cassandra
Virtual Nodes: Rethinking Topology in CassandraVirtual Nodes: Rethinking Topology in Cassandra
Virtual Nodes: Rethinking Topology in Cassandra
Eric Evans
 
Rethinking Topology In Cassandra (ApacheCon NA)
Rethinking Topology In Cassandra (ApacheCon NA)Rethinking Topology In Cassandra (ApacheCon NA)
Rethinking Topology In Cassandra (ApacheCon NA)
Eric Evans
 
Time Series Data with Apache Cassandra
Time Series Data with Apache CassandraTime Series Data with Apache Cassandra
Time Series Data with Apache Cassandra
Eric Evans
 

Viewers also liked (20)

Python and cassandra
Python and cassandraPython and cassandra
Python and cassandra
 
Wikimedia Content API: A Cassandra Use-case
Wikimedia Content API: A Cassandra Use-caseWikimedia Content API: A Cassandra Use-case
Wikimedia Content API: A Cassandra Use-case
 
Wikimedia Content API: A Cassandra Use-case
Wikimedia Content API: A Cassandra Use-caseWikimedia Content API: A Cassandra Use-case
Wikimedia Content API: A Cassandra Use-case
 
Webinar Degetel DataStax
Webinar Degetel DataStaxWebinar Degetel DataStax
Webinar Degetel DataStax
 
Wikimedia Content API (Strangeloop)
Wikimedia Content API (Strangeloop)Wikimedia Content API (Strangeloop)
Wikimedia Content API (Strangeloop)
 
Castle enhanced Cassandra
Castle enhanced CassandraCastle enhanced Cassandra
Castle enhanced Cassandra
 
Time Series Data with Apache Cassandra (ApacheCon EU 2014)
Time Series Data with Apache Cassandra (ApacheCon EU 2014)Time Series Data with Apache Cassandra (ApacheCon EU 2014)
Time Series Data with Apache Cassandra (ApacheCon EU 2014)
 
Webinaire Business&Decision - Trifacta
Webinaire  Business&Decision - TrifactaWebinaire  Business&Decision - Trifacta
Webinaire Business&Decision - Trifacta
 
DataStax et Apache Cassandra pour la gestion des flux IoT
DataStax et Apache Cassandra pour la gestion des flux IoTDataStax et Apache Cassandra pour la gestion des flux IoT
DataStax et Apache Cassandra pour la gestion des flux IoT
 
DataStax Enterprise BBL
DataStax Enterprise BBLDataStax Enterprise BBL
DataStax Enterprise BBL
 
Virtual Nodes: Rethinking Topology in Cassandra
Virtual Nodes: Rethinking Topology in CassandraVirtual Nodes: Rethinking Topology in Cassandra
Virtual Nodes: Rethinking Topology in Cassandra
 
Cassandra by Example: Data Modelling with CQL3
Cassandra by Example:  Data Modelling with CQL3Cassandra by Example:  Data Modelling with CQL3
Cassandra by Example: Data Modelling with CQL3
 
Virtual Nodes: Rethinking Topology in Cassandra
Virtual Nodes: Rethinking Topology in CassandraVirtual Nodes: Rethinking Topology in Cassandra
Virtual Nodes: Rethinking Topology in Cassandra
 
It's not you, it's me: Ending a 15 year relationship with RRD
It's not you, it's me: Ending a 15 year relationship with RRDIt's not you, it's me: Ending a 15 year relationship with RRD
It's not you, it's me: Ending a 15 year relationship with RRD
 
Time Series Data with Apache Cassandra
Time Series Data with Apache CassandraTime Series Data with Apache Cassandra
Time Series Data with Apache Cassandra
 
Rethinking Topology In Cassandra (ApacheCon NA)
Rethinking Topology In Cassandra (ApacheCon NA)Rethinking Topology In Cassandra (ApacheCon NA)
Rethinking Topology In Cassandra (ApacheCon NA)
 
Lightning fast analytics with Cassandra and Spark
Lightning fast analytics with Cassandra and SparkLightning fast analytics with Cassandra and Spark
Lightning fast analytics with Cassandra and Spark
 
Time Series Data with Apache Cassandra
Time Series Data with Apache CassandraTime Series Data with Apache Cassandra
Time Series Data with Apache Cassandra
 
Time series storage in Cassandra
Time series storage in CassandraTime series storage in Cassandra
Time series storage in Cassandra
 
Cassandra 2.2 & 3.0
Cassandra 2.2 & 3.0Cassandra 2.2 & 3.0
Cassandra 2.2 & 3.0
 

Similar to CQL In Cassandra 1.0 (and beyond)

MariaDB Cassandra Interoperability
MariaDB Cassandra InteroperabilityMariaDB Cassandra Interoperability
MariaDB Cassandra Interoperability
Colin Charles
 
Mysqlconf2013 mariadb-cassandra-interoperability
Mysqlconf2013 mariadb-cassandra-interoperabilityMysqlconf2013 mariadb-cassandra-interoperability
Mysqlconf2013 mariadb-cassandra-interoperability
Sergey Petrunya
 
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
Ontico
 
Scaling web applications with cassandra presentation
Scaling web applications with cassandra presentationScaling web applications with cassandra presentation
Scaling web applications with cassandra presentation
Murat Çakal
 

Similar to CQL In Cassandra 1.0 (and beyond) (20)

Cassandra Java APIs Old and New – A Comparison
Cassandra Java APIs Old and New – A ComparisonCassandra Java APIs Old and New – A Comparison
Cassandra Java APIs Old and New – A Comparison
 
MariaDB Cassandra Interoperability
MariaDB Cassandra InteroperabilityMariaDB Cassandra Interoperability
MariaDB Cassandra Interoperability
 
Performance improvements in PostgreSQL 9.5 and beyond
Performance improvements in PostgreSQL 9.5 and beyondPerformance improvements in PostgreSQL 9.5 and beyond
Performance improvements in PostgreSQL 9.5 and beyond
 
Mysqlconf2013 mariadb-cassandra-interoperability
Mysqlconf2013 mariadb-cassandra-interoperabilityMysqlconf2013 mariadb-cassandra-interoperability
Mysqlconf2013 mariadb-cassandra-interoperability
 
Maria db cassandra interoperability cassandra storage engine in mariadb
Maria db cassandra interoperability cassandra storage engine in mariadbMaria db cassandra interoperability cassandra storage engine in mariadb
Maria db cassandra interoperability cassandra storage engine in mariadb
 
Meetup cassandra sfo_jdbc
Meetup cassandra sfo_jdbcMeetup cassandra sfo_jdbc
Meetup cassandra sfo_jdbc
 
Streams Don't Fail Me Now - Robustness Features in Kafka Streams
Streams Don't Fail Me Now - Robustness Features in Kafka StreamsStreams Don't Fail Me Now - Robustness Features in Kafka Streams
Streams Don't Fail Me Now - Robustness Features in Kafka Streams
 
Building a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and SparkBuilding a High-Performance Database with Scala, Akka, and Spark
Building a High-Performance Database with Scala, Akka, and Spark
 
Hibernate 6.1 - What's new.pdf
Hibernate 6.1 - What's new.pdfHibernate 6.1 - What's new.pdf
Hibernate 6.1 - What's new.pdf
 
Cassandra 2012
Cassandra 2012Cassandra 2012
Cassandra 2012
 
Online Analytics with Hadoop and Cassandra
Online Analytics with Hadoop and CassandraOnline Analytics with Hadoop and Cassandra
Online Analytics with Hadoop and Cassandra
 
Cassandra at BrightTag
Cassandra at BrightTagCassandra at BrightTag
Cassandra at BrightTag
 
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
Tarantool как платформа для микросервисов / Антон Резников, Владимир Перепели...
 
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
Oracle Database 12c - The Best Oracle Database 12c Tuning Features for Develo...
 
JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course
JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course
JDD 2016 - Tomasz Borek - DB for next project? Why, Postgres, of course
 
Dun ddd
Dun dddDun ddd
Dun ddd
 
What's New In PostgreSQL 9.4
What's New In PostgreSQL 9.4What's New In PostgreSQL 9.4
What's New In PostgreSQL 9.4
 
从 Oracle 合并到 my sql npr 实例分析
从 Oracle 合并到 my sql   npr 实例分析从 Oracle 合并到 my sql   npr 实例分析
从 Oracle 合并到 my sql npr 实例分析
 
Scaling web applications with cassandra presentation
Scaling web applications with cassandra presentationScaling web applications with cassandra presentation
Scaling web applications with cassandra presentation
 
QoS marking on cisco IOS Router
QoS marking on cisco IOS RouterQoS marking on cisco IOS Router
QoS marking on cisco IOS Router
 

More from Eric Evans (8)

Cassandra By Example: Data Modelling with CQL3
Cassandra By Example: Data Modelling with CQL3Cassandra By Example: Data Modelling with CQL3
Cassandra By Example: Data Modelling with CQL3
 
Cassandra: Not Just NoSQL, It's MoSQL
Cassandra: Not Just NoSQL, It's MoSQLCassandra: Not Just NoSQL, It's MoSQL
Cassandra: Not Just NoSQL, It's MoSQL
 
NoSQL Yes, But YesCQL, No?
NoSQL Yes, But YesCQL, No?NoSQL Yes, But YesCQL, No?
NoSQL Yes, But YesCQL, No?
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra Explained
 
Outside The Box With Apache Cassnadra
Outside The Box With Apache CassnadraOutside The Box With Apache Cassnadra
Outside The Box With Apache Cassnadra
 
The Cassandra Distributed Database
The Cassandra Distributed DatabaseThe Cassandra Distributed Database
The Cassandra Distributed Database
 
An Introduction To Cassandra
An Introduction To CassandraAn Introduction To Cassandra
An Introduction To Cassandra
 
Cassandra In A Nutshell
Cassandra In A NutshellCassandra In A Nutshell
Cassandra In A Nutshell
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

CQL In Cassandra 1.0 (and beyond)

  • 1. CQL In Cassandra 1.0 (and beyond) Big Data DC Meetup #5 October 17, 2011 Eric Evans eric@acunu.com @jericevans, @acunu
  • 2. Overview, history, motivation ● Changes in CQL 2.0 (Cassandra 1.0) ● Coming soon (?) ● Drivers status
  • 3. What? ● Cassandra Query Language ● aka CQL ● aka /ˈsēkwəl/ ● Exactly like SQL (except where it's not) ● Introduced in Cassandra 0.8.0 ● Ready for production use
  • 4. SQL? Almost. –- Inserts or updates INSERT INTO Standard1 (KEY, col0, col1) VALUES (key, value0, value1) vs. –- Inserts or updates UPDATE Standard1 SET col0=value0, col1=value1 WHERE KEY=key
  • 5. SQL? Almost. –- Get columns for a row SELECT col0,col1 FROM Standard1 WHERE KEY=key –- Range of columns for a row SELECT col0..colN FROM Standard1 WHERE KEY=key –- First 10 results from a range of columns SELECT FIRST 10 col0..colN FROM Standard1 WHERE KEY=key –- Invert the sorting of results SELECT REVERSED col0..colN FROM Standard1 WHERE KEY=key
  • 8. (Un)ease of use Column col = new Column(ByteBuffer.wrap(“name”.getBytes())); col.setValue(ByteBuffer.wrap(“value”.getBytes())); col.setTimestamp(System.currentTimeMillis()); ColumnOrSuperColumn cosc = new ColumnOrSuperColumn(); cosc.setColumn(col); Mutation mutation = new Mutation(); Mutation.setColumnOrSuperColumn(cosc); List mutations = new ArrayList<Mutation>(); mutations.add(mutation); Map mutations_map = new HashMap<ByteBuffer, Map<String, List<Mutation>>>(); Map cf_map = new HashMap<String, List<Mutation>>(); cf_map.set(“Standard1”, mutations); mutations.put(ByteBuffer.wrap(“key”.getBytes()), cf_map)
  • 9. CQL INSERT INTO Standard1 (KEY, col0) VALUES (key, value0)
  • 10. Why? How about... ● Better stability guarantees ● Easier to use (you already know it) ● Better code readability / maintainability
  • 11. Why? How about... ● Better stability guarantees ● Easier to use (you already know it) ● Better code readability / maintainability ● Irritates the NoSQL purists
  • 12. Why? How about... ● Better stability guarantees ● Easier to use (you already know it) ● Better code readability / maintainability ● Irritates the NoSQL purists ● (Still )irritates the SQL purists
  • 13.
  • 15. Wait, 2.0? You call that stable? Yes yes, but... ● We had a few FUBARs in the first pass ● Not the norm, honest ● It's a mulligan ● Look, cats!
  • 16. Changed in 2.0 ● SELECT count(...) FROM now returns row, not column count ● Terms / Types ● bytea became blob ● int became 4-bytes (was arbitrary precision) ● date became timestamp
  • 17. Also new (but not breaking) ● Named keys (virtual columns) ● Counters ● Complete DDL support ● Timestamps and TTLs
  • 18. Named Keys –- An unnamed key uses the KEY keyword CREATE TABLE Standard1 (KEY text PRIMARY KEY) –- But you can also name one like so... CREATE TABLE Standard1 (username text PRIMARY KEY) –- The name will also be used in results! SELECT email FROM Standard1 WHERE username = 'jericevans'
  • 19. Counters –- Counter increment UPDATE Standard1 SET acount = acount + 1 WHERE KEY = key –- Counter decrement UPDATE Standard1 SET acount = acount - 1 WHERE KEY = key –- 1 not enough? Go nuts. UPDATE Standard1 SET acount = acount + 9 WHERE KEY = key
  • 20. Timestamps and TTLs –- Inserts or updates UPDATE CFam USING TIMESTAMP 131851901600 SET col0=value0, col1=value1 WHERE KEY=key –- Inserts or updates UPDATE CFam USING TTL 86400 SET col0=value0, col1=value1 WHERE KEY=key
  • 22. Roadmap ● Prepared statements (CASSANDRA-2475) ● Compound columns (CASSANDRA-2474) ● Custom transport / protocol (CASSANDRA-2478) ● Performance testing (CASSANDRA-2268) ● Schema introspection (CASSANDRA-2477) ● Multiget support (CASSANDRA-3069)
  • 24. Drivers ● Hosted on Apache Extras (Google Code) ● Tagged cassandra and cql ● Licensed using Apache License 2.0 ● Conforming to a standard for database connectivity (if applicable) ● Coming soon, automated testing and acceptance criteria
  • 25. Drivers Driver Platform Status cassandra-jdbc Java Good cassandra-dbapi2 Python Good cassandra-ruby Ruby New cassandra-pdo PHP New cassandra-node Node.js Good http://code.google.com/a/apache-extras.org/hosting/search?q=label%3aCassandra