Unfortunately, CQL is not SQL, and queries like this do not work in cqlsh as they do in their relational counterparts. The DataStax SELECT documentation indicates that a selector must be one of:
- column name
- WRITETIME (column name)
- TTL (column name)
- function
Now while a SELECT 1 as id
query may not work, there are other, slightly more useful things that do. For instance, if I need to quickly generate a UUID, I can do so with the following query:
aploetz@cqlsh:stackoverflow> SELECT uuid() FROM system.local;
system.uuid()
--------------------------------------
a55c17f7-d19d-4531-85be-75551e3fd546
(1 rows)
This works the way it does for two reasons:
The SELECT clause invokes the uuid() function.
The system.local table only ever contains a single row. If you ran this SELECT against another table, it would return as many UUIDs as there were CQL rows.