Cassandra Query Language (CQL) defines, queries, and modifies Cassandra data and schemas. Its command-line shell, cqlsh, provides a practical way to prepare a keyspace and inspect persisted rows. section 4.1.1 section 4.1.3
A small Cassandra application workflow uses CQL to:
- Create a keyspace that groups Cassandra tables, using replication settings and durable writes. section 4.1.1
- Query table rows through cqlsh, including simple columns and collections containing user-defined values. section 4.1.3
- Prepare the keyspace that Spring Data Cassandra uses through application configuration. section 4.1.1
Creating and inspecting Taco Cloud data
At the cqlsh prompt, create the tacocloud keyspace with SimpleStrategy, one replica, and durable writes. Then query the tacos table with `select id, name, createdAt, ingredients from tacos;`. The ingredients value appears as a collection of user-defined ingredient objects. section 4.1.1 section 4.1.3
cqlsh> create keyspace tacocloud
... with replication={'class':'SimpleStrategy', 'replication_factor':1}
... and durable_writes=true;
View the complete cqlsh command for creating the tacocloud keyspace. section 4.1.1
cqlsh:tacocloud> select id, name, createdAt, ingredients from tacos;
id | name | createdat | ingredients
----------+-----------+-----------+----------------------------------------
827390...| Carnivore | 2018-04...| [{name: 'Flour Tortilla', type: 'WRAP'},
{name: 'Carnitas', type: 'PROTEIN'},
{name: 'Sour Cream', type: 'SAUCE'},
{name: 'Salsa', type: 'SAUCE'},
{name: 'Cheddar', type: 'CHEESE'}]
(1 rows)
View a complete CQL query and its returned taco row with embedded ingredients. section 4.1.3

