Main namespace for working with CQL, prepared statements. Convenience functions
for key operations built on top of CQL.


(alter-keyspace session & query-params)
Alters properties of an existing keyspace. The
supported properties are the same that for `create-keyspace`


(alter-table session & query-params)
Alters a table definition. Use it to add new
columns, drop existing ones, change the type of existing columns, or update the table options.


(alter-user session & query-params)


(atomic-batch session & clauses)
Executes a group of operations as an atomic batch (BEGIN BATCH ... APPLY BATCH)



(create-index session & query-params)
Creates a new (automatic) secondary index for a given (existing)
column in a given table.If data already exists for the column, it will be indexed during the execution
of this statement. After the index is created, new data for the column is indexed automatically at
insertion time.

Example, creates an index on `users` table, `city` column:

   (create-index conn :users :city
                 (index-name :users_city)


(create-keyspace session & query-params)
Creates a new top-level keyspace. A keyspace is a namespace that
defines a replication strategy and some options for a set of tables,
similar to a database in relational databases.


  (create-keyspace conn :new_cql_keyspace
                (with {:replication
                       {:class "SimpleStrategy"
                        :replication_factor 1}}))


(create-table session & query-params)
Creates a new table. A table is a set of rows (usually
representing related entities) for which it defines a number of properties.

A table is defined by a name, it defines the columns composing rows
of the table and have a number of options.


  (create-table :users
             (column-definitions {:name :varchar
                                  :age  :int
                                  :city :varchar
                                  :primary-key [:name]}))


(create-user session & query-params)


(delete session table & query-params)
Deletes columns and rows. If the `columns` clause is provided,
only those columns are deleted from the row indicated by the `where` clause, please refer to
doc guide ( for more details. Otherwise whole rows
are removed. The `where` allows to specify the key for the row(s) to delete. First argument
for this function should always be table name.


(delete-async session table & query-params)
Same as delete but returns a future


(describe-columns session ks table)
Returns table columns description, taken from `system.schema_columns`.


(describe-keyspace session ks)
Returns a keyspace description, taken from `system.schema_keyspaces`.


(describe-table session ks table)
Returns a table description, taken from `system.schema_columnfamilies`.


(drop-index session & query-params)
Drop an existing secondary index. The argument of the statement
is the index name.

Example, drops an index on `users` table, `city` column:

    (drop-index th/session :users_city)


(drop-keyspace session ks)
Drops a keyspace: results in immediate, irreversible removal of an existing keyspace,
including all column families in it, and all data contained in those column families.


(drop-table session ks)
Drops a table: this results in the immediate, irreversible removal of a table, including
all data in it.


(drop-user session & query-params)


(get-one session & query-params)
Executes query to get exactly one result. Does not add `limit` clause to the query, this is
a convenience function only. Please use `limit` clause if you execute queries that potentially
return more than a single result.


(grant session & query-params)


(insert session & query-params)
Inserts a row in a table.

Note that since a row is identified by its primary key, the columns that compose it must be
specified. Also, since a row only exists when it contains one value for a column not part of
the primary key, one such value must be specified too.


(insert-async session & query-params)
Same as insert but returns a future


(insert-batch session table records)
Performs a batch insert (inserts multiple records into a table at the same time).
To specify additional clauses for a record (such as where or using), wrap that record
and the clauses in a vector


(insert-batch-async session table records)
Same as insert-batch but returns a future


(iterate-table session table partition-key chunk-size)(iterate-table session table partition-key chunk-size c)
Lazily iterates through a table, returning chunks of chunk-size.


(list-permissions session & query-params)


(list-users session & query-params)


(perform-count session table & query-params)
Helper function to perform count on a table with given query. Count queries are slow in Cassandra,
in order to get a rough idea of how many items you have in certain table, use `nodetool cfstats`,
for more complex cases, you can wither do a full table scan or perform a count with this function,
please note that it does not have any performance guarantees and is potentially expensive.


(revoke session & query-params)


(select session & query-params)
Retrieves one or more columns for one or more rows in a table.
It returns a result set, where every row is a collection of columns returned by the query.


(select-async session & query-params)
Same as select but returns a future


(truncate session table)
Truncates a table: permanently and irreversably removes all rows from the table,
not removing the table itself.


(update session & query-params)
Updates one or more columns for a given row in a table. The `where` clause
is used to select the row to update and must include all columns composing the PRIMARY KEY.
Other columns values are specified through assignment within the `set` clause.


(update-async session & query-params)
Same as update but returns a future


(use-keyspace session ks)
Takes an existing keyspace name as argument and set it as the per-session current working keyspace.
All subsequent keyspace-specific actions will be performed in the context of the selected keyspace,
unless otherwise specified, until another USE statement is issued or the connection terminates.