Perform Cassandra Query Assertion
The Perform Cassandra Query assertion allows you to write and save a CQL (Cassandra Query Language) prepared statement for querying an external data source using a Cassandra connection. This assertion supports Batch statements, allowing you to group multiple DML (Data Modification Language) statements (INSERT, UPDATE, DELETE) into a single logical operation. This saves network exchanges between the client/server and server coordinator/replica.
Perform Cassandra Queryassertion allows you to write and save a CQL (Cassandra Query Language) prepared statement for querying an external data source using a Cassandra connection. This assertion supports Batch statements, allowing you to group multiple DML (Data Modification Language) statements (INSERT, UPDATE, DELETE) into a single logical operation. This saves network exchanges between the client/server and server coordinator/replica.
This assertion supports Cassandra 2.1.2 and CQL3.
- At least one Cassandra connection is defined on the Gateway. For more information, see Manage Cassandra Connections.
This assertion sets the following context variables:
Contains the number of rows returned. If no results are returns, then this variable contains '0'.
Contains the Cassandra query result in XML form. Set only if the "Generate XML Result" option is selected in the assertion.
When Context Variables Naming is configured, columns from the Cassandra Query result are stored in the mapped context variable.
See Cassandra Cluster Properties for details.
What you should know...
These connections are defined using the Manage Cassandra Connections task.
The Cassandra query timeout, in seconds. A value of '0' means to never time out.
Query statement box
Enter the Cassandra query statements here, in CQL3. You can include context variables that will be interpreted as parameters for the prepared statement.
This tests whether a CQL query is valid based on the selected connection. Be aware of these important notes before testing:
Context Variable Naming
This is the mapping between Cassandra columns that are returned from the query and the context variables set in the policy. For example, you map the Cassandra result set column name "id" to the variable name cassandraQuery.identifier (where "cassandraQuery" is the variable prefix).
When mapping is configured, the corresponding context variable name replaces the Cassandra result set column name. When mapping is not enabled, the original column name is used.
The maximum number of records returned by the query
The value is initially set to the
cassandra.maxRecordscluster property, which has a default of
Query Fetch Size
The number of records in a page that is returned in one round trip to the Cassandra server. Changing the value allows you to set a different fetch size for this query.
This value is initially set to the
cassandra.fetchSizecluster property, which has a default of
Fail assertion if there are no results returned by the query
When set, assertion fails only if a select query returns an empty result set. Other queries (such as INSERT, UPDATE, DELETE, and other DDL statements) are not affected by this setting.
Generate XML Result
When set, the result set returned by the Cassandra server is converted to XML and placed in the
The root element is cassandraQueryResult, while the XML namespace is L7j.
Context Variable Data Types
The following mappings show which context variable data type should be used for each of the Cassandra data types:
For Cassandra data type...
Use context variable of type...
Integer or String
You cannot use context variables for any Cassandra data type not listed in the above table.
Frequently Asked Questions
Why are no connections visible in the drop-down list?
You must first define a connection using the Manage Cassandra Connections task.
Why must I specify a variable prefix?
This helps create unique variable names and prevents variables from overwriting each other when an assertion appears more than once in a policy.
Why did the assertion succeed even though no results were returned.
Verify that: (1) The "Fail assertion..." check box is selected. (2) You have used a "select" query command. Other commands will not fail the assertion when no results are returned.