qbits.hayt.dsl

add-column

(add-column identifier type)

Clause: takes a table identifier and a column type

allow-filtering

(allow-filtering value)(allow-filtering)

Clause: sets ALLOW FILTERING on select queries, defaults to true is used without a value

alter-column

(alter-column identifier type)

Clause: takes a table identifier and a column type

alter-column-family

deprecated in 1.5.0

alter-columnfamily

(alter-columnfamily columnfamily & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#alterTableStmt

Takes a columnfamiliy identifier and additional clause arguments:

  • alter-column
  • add-column
  • alter-column
  • rename-column
  • drop-column
  • with

alter-keyspace

(alter-keyspace keyspace & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#alterKeyspaceStmt

Takes a keyspace identifier and a with clause.

alter-table

(alter-table table & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#alterTableStmt

Takes a table identifier and additional clause arguments:

  • alter-column
  • add-column
  • alter-column
  • rename-column
  • drop-column
  • with

alter-type

(alter-type type & clauses)

alter-user

(alter-user user & clauses)

Takes clauses: * password * superuser (defaults to false)

batch

(batch & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#batchStmt

Takes hayt queries optional clauses: * queries * using * counter * logged

column-definitions

(column-definitions column-definitions)

Clause: Takes a map of columns definitions (keys are identifiers , values, types), to be used with create-table.

columns

(columns & columns)

Clause: takes columns identifiers ex: (columns :foo “bar” :baz)

counter

(counter value)(counter)

Clause: Sets COUNTER attribute on BATCH queries

create-index

(create-index table name & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#createIndexStmt

Takes a table identifier and additional clause arguments:

  • index-column
  • index-name
  • custom
  • on (overwrites table id)

create-keyspace

(create-keyspace keyspace & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#createKeyspaceStmt

Takes a keyspace identifier and clauses: * with

create-table

(create-table table & clauses)

Takes a table identifier and additional clause arguments:

  • column-definitions
  • with

create-trigger

(create-trigger trigger table using)

create-type

(create-type type & clauses)

create-user

(create-user user & clauses)

Takes clauses: * password * superuser (defaults to false)

custom

(custom x)(custom)

Clause: Sets CUSTOM status on create-index query

delete

(delete table & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#deleteStmt

Takes a table identifier and additional clause arguments:

  • columns (defaults to *)
  • using
  • where
  • only-if

drop-column

(drop-column id)

Clause: Takes a column Identifier

drop-columnfamily

(drop-columnfamily cf & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#dropTableStmt

Takes a column family identifier and additional clauses: * if-exists

drop-index

(drop-index index & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#dropIndexStmt

Takes an index identifier and additional clauses: * if-exists

drop-keyspace

(drop-keyspace keyspace & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#dropKeyspaceStmt

Takes a keyspace identifier and additional clauses: * if-exists

drop-table

(drop-table table & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#dropTableStmt

Takes a table identifier and additional clauses: * if-exists

drop-trigger

(drop-trigger trigger table)

http://cassandra.apache.org/doc/cql3/CQL.html#dropTriggerStmt

Takes a trigger identifier and a table identifier

drop-type

(drop-type type & clauses)

http://docs.datastax.com/en/cql/3.3/cql/cql_reference/cqlRefDropType.html

Takes a type identifier and additional clauses: * if-exists

drop-user

(drop-user user & clauses)

Takes a user identifier * if-exists

grant

(grant perm & clauses)

Takes clauses: * resource * user

if-exists

(if-exists b)(if-exists)

Clause: Apply only if the target exists

if-not-exists

(if-not-exists b)(if-not-exists)

DEPRECATED use (if-exists false) Clause: Apply only if the row does not exist

index-name

(index-name value)

Clause: Takes an index identifier

insert

(insert table & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#insertStmt

Takes a table identifier and additional clause arguments: * values * using * if-exists

limit

(limit n)

Clause: Sets LIMIT, takes a numeric value

list-perm

(list-perm & clauses)

Takes clauses: * perm (defaults to ALL if not supplied) * user * resource * recursive (defaults to true)

list-users

(list-users)

logged

(logged value)(logged)

Clause: Sets LOGGED/UNLOGGED attribute on BATCH queries

only-if

(only-if args)

Clause: takes a map or a vector of pairs (same as where) to compose the if clause of a update/delete query

only-if'

(only-if' & args)

Clause: takes a map or a vector of pairs (same as where) to compose the if clause of a update/delete query

order-by

(order-by & columns)

Clause: takes vectors of 2 elements, where the first is the column identifier and the second is the ordering as keyword. ex: (order-by [:asc :desc])

password

(password value)

Clause: To be used with alter-user and create-user, sets password

perm

(perm value)

Clause: Sets permission to be listed with list-perm

queries

(queries & queries)

Clause: takes hayt queries to be executed during a batch operation.

recursive

(recursive value)(recursive)

Clause: Sets recusivity on list-perm (LIST PERMISSION) queries

rename-column

(rename-column old-name new-name)

Clause: rename from old-name to new-name

resource

(resource value)

Clause: Sets resource to be modified/used with grant or list-perm

revoke

(revoke perm & clauses)

Takes clauses: * resource * user

select

(select table & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#selectStmt

Takes a table identifier and additional clause arguments:

  • columns (defaults to *)
  • where
  • order-by
  • limit
  • only-if

set-columns

(set-columns values)(set-columns x y & more)

Clause: Takes a map of columns to be updated

superuser

(superuser value)(superuser)

Clause: To be used with alter-user and create-user, sets superuser status

truncate

(truncate table)

update

(update table & clauses)

http://cassandra.apache.org/doc/cql3/CQL.html#updateStmt

Takes a table identifier and additional clause arguments:

  • using
  • set-columns
  • where
  • only-if
  • if-exists

use-keyspace

(use-keyspace keyspace)

user

(user value)

Clause: Sets user to be modified/used with grant or list-perm

using

(using opts)(using x y & more)

Clause: Sets USING, takes keyword/value pairs for :timestamp and :ttl

values

(values values)(values x y & more)

Clause: Takes a map of columns to be inserted

where

(where args)

Clause: takes a map or a vector of pairs to compose the where clause of a select/update/delete query

where'

(where' & args)

Same as where but for people who prefer unrolled args

where1

(where1 args)(where1 x y & more)

backward compatible with hayt 1.0 and 2.0 betas

with

(with values)(with x y & more)

Clause: compiles to a CQL with clause (possibly nested maps)