Query

Query is an asynchronous activity that helps query data from a Cassandra table.

General

The General tab contains the following fields:

Field Literal Value/Process Property/Module Property? Description
Name None The name to be displayed as the label for the activity in the process.
Cassandra Connection Literal Value

Module Property

Shared configuration resource containing the Cassandra connection information.
Statement None Input the CQL statement to perform on the KeySpace.
Fetch Output Schema None

When you first configure the Query activity, click Fetch Output Schema to populate the schema/columns of the table in the Query Output.

After you have configured your activity, this button is useful when you make a change in the table. Fetch Output Schema synchronizes with the table and changes the output schema, if necessary.

Ensure that the table used in the Statement is defined in the keyspace.

Fetch UserTypes None This button fetches the User Defined Data Types (UDT) for the Prepared Statements and Query Output.
Remember: The UDT fetch is successful if the following requirements are met:
  • Cassandra Shared Resource connection is ready and is provided in the Cassandra Connection field in the activity.
  • The UDTs are already defined in the keyspace.
For every new activity, you must fetch the UDT again. If you make changes to the UDT in the back end, ensure to fetch it again to see the latest types.
Use Nested Collections None Select this check box if you are using nested collections in the Prepared Statements and Query Output.

If the check box is selected, enter the table name used in the Statement above.

Fetch Columns fetches the nested columns in the Data Type/Nested Collection drop-down of the Prepared Statements.

Note: See the following examples for using nested collections:
  • List<list<datatype>> - You can use nested collection column of type List of a data type, nested within List.
  • Set<Set<datatype>> - You can use nested collection column of type Set of a data type, nested within Set.
  • Map<text, List<datatype>> - You can use nested collection column of type Map with key as a data type and value as List of a data type.

Similarly, you can have other combinations using List, Set and Map.

Prepared Statements None

The Prepared Statements contains the Parameter Name, Parameter Cardinality and Data Type/Nested Collection fields. All the parameters defined in Prepared Statements are available in the Input tab of the activity for the user to provide values.

Each parameter corresponds to the question mark in the same position in the CQL statement. That is, the first parameter in the list corresponds to the first question mark, the second parameter in the list corresponds to the second question mark, and so on. The warning is only for the purpose of information. Ensure that the parameters in this field correctly correspond to the statement.

You can optionally specify names for each parameter. By default, the parameters are named Parameter, Parameter1, and so on. You must supply the data type of each parameter to the CQL statement, and this data type is used in the input schema for the statement

Query Output None

The Query Output contains the Parameter Name, Parameter Cardinality and Data Type/Nested Collection fields. All the parameters defined in the Query Output table are shown in the Output tab of the activity for display the query result.

Each Query Output corresponds to field name in the table. The warning is only for information. Ensure that the parameters in this field correctly correspond to the table fields.

For the query output, use the parameter name that corresponds to the table field. You must supply the data type of each parameter that corresponds to the table field. This data type is used in the output schema for the query result.

With the Parameter Cardinality drop-down you can map a data type of type Collection. The Collection data type is one of the following:
  • Map
  • Set
  • List
Note: When you select Map as the cardinality of a parameter:
  • You must provide the Key Type and Value Type for its Data Type/Nested Collection.
  • In case of nested collections, select the Data Type/Nested Collection of the parameter before you select its cardinality.

Description

Provide a short description for the activity.

Advanced

This tab has the following fields:

Field Literal Value/Process Property/Module Property? Description
Read Consistency All Refers to how up-to-date and synchronized a row of Cassandra data is on all of its replicas.
Tracing None The check box for turning the tracing for activity on or off. Checking this box turns the tracing on, which helps you understand Cassandra's internal operations and troubleshoot performance related issues.

Input

This tab the following fields:

Input Item Data Type Mandatory? Description
Statement String No
Input the CQL statement to perform in the KeySpace.
Note: This field takes precedence over the statement field in General tab.
FetchSize Integer No The size of data that gets queried after executing the activity once.
Note: This field has a higher priority than it has in the Cassandra shared resource connection.
ReadSize Integer No

The size of data that you want to retrieve from a table by executing this activity. For example, if ReadSize = 100 and FetchSize = 20, it creates a group for the activity which executes 5 times to get the data.

The default value of ReadSize is Integer.MaxValue.

ServerTimeZone String No The ServerTimeZone is used for the timestamp data type. If you use Prepared Statements to insert timestamp data, map it to ServerTimeZone. It is the database server machine time zone, for example: America/New_York .
Note: For the timestamp data type, when you insert a timestamp data to the database, Cassandra converts the data with database server machine time zone. When you query the data, Cassandra converts the data according to the plug-in machine time zone. So, if the server machine and plug-in machine time zone configuration is not same, the timestamp data display differs from the database plug-in output. When you use Prepared Statements to insert timestamp data, be sure to input it in ServerTimeZone in the Input tab.
Tip: It is best that you set the same time zone for database machine and plug-in machine.

Output

This tab has the following fields:

Output Item Data Type Description
ResultSetInfo The information for Query activity executed.
QueriedHost String Return the Cassandra host that coordinated this execution.
NoMore Boolean Whether there is more data in the table after the query completes. The default has no more data that matches the query condition.
Rows The rows value that is returned from the query.
Row String Each row value data.
Note: If you are using nested collections, for the nested column schema to reflect in the Row, ensure that you enter the table name and fetch the columns in the General tab.
TraceID String

Return the operation message data ID that is saved in the database. You can use this ID to query the database.

For example: SELECT * FROM system_traces.sessions WHERE session_id =?

Note: This field is displayed only when the Tracing check box on the Advanced tab is selected.

Fault

The Fault tab lists exceptions that are thrown by this activity:

Error Schema Element Data Type Description
CassandraPluginException Any exception thrown by the activity after execution. It has a msg and msgCode field for the exception.
DriverException Any exception thrown by the Cassandra driver. It has a msg and msgCode field for the exception.
msg string The error message returned by the plug-in.
msgCode string The error code returned by the plug-in.