////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at
  http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /workflow/actions/
:language: en_US
:description: The Cassandra Exec CQL action executes one or more CassandraQL statements on a Cassandra cluster.

:openvar: ${
:closevar: }

= Cassandra Exec CQL

The `Cassandra Exec CQL` action executes one or more Cassandra Quqery Languague (SQL) statements on a Cassandra cluster.

You can use it to create or drop key spaces, tables, indexes and so on.

If all statements executed successfully the result will be true (success).

Check the https://cassandra.apache.org/doc/stable/cassandra/cql/[Cassandra docs] for more information about CQL.

== Options

[%header, width="90%", cols="1,3"]
|===
|Option|Description
|xref:metadata-types/cassandra/cassandra-connection.adoc[Cassandra Connection]| You can specify the name of the connection to use either as a fixed value or as a variable expression.
There are buttons to the right of the input field to hel you manage the metadata.
|CQL Script| You can enter one or more CQL statements ending with a semi-colon on a new line.
|Replace variables in script|Check this option to added variables in your CQL script. These variables will be replaced with the variables values before sending the CQL script to the Cassandra cluster.
|===

== Example:

[source]
----
CREATE KEYSPACE IF NOT EXISTS hop
WITH replication = {'class':'SimpleStrategy', 'replication_factor' : 3}
;
----

== Result rows

It's possible to perform one or more queries in this action.  The output of the queries will be added to the result rows of the action.  You can access these with the plugins like the xref:pipeline/transforms/getrowsfromresult.adoc[Get Rows From Result] transform or in the xref:workflow/actions/eval.adoc[JavaScript] action.
Please note that result rows are kept in memory so this is intended for small queries, for example getting information from the `system_schema` tables.
