Cassandra - Select

On this Page

Snap type:

Transform

Description:

This Snap allows you to fetch data from a Cassandra database by providing a table name and configuring the connection. The Snap produces the records from the database on its output view which can then be processed by a downstream Snap. Limit and offset are not supported by Cassandra JDBC driver.

Queries produced by the Snap have an equivalent format:


Expected upstream Snaps
: Snaps that will either input data into Cassandra Execute, merge information with Cassandra, or required to precede execution before Cassandra execution. If more powerful functionality is desired, then the Execute Snap should be used.

  • Expected downstream Snaps: Snaps that use information fetched from Cassandra or that is dependent on Cassandra having executed prior.
  • Expected input: Data, if any,  to be used to narrow the selection of data coming from Cassandra.
  • Expected output: Data of interest from Cassandra.
Prerequisites:

Validated Cassandra account, verified network connectivity to Cassandra server and port, and the Cassandra server running.

Support and limitations:
  • Works in Ultra Tasks.
  • The Cassandra Snap Pack does not support the following data types introduced in Apache Cassandra V3.x, as the underlying SnapLogic JDBC driver is designed to work with Apache Cassandra V2.1:
    • DateRange
    • Duration
    • Geo-spatial data types such as Point, Polygon and LineString

Snaps in this Snap Pack display an exception (raised by the JDBC driver) when you query a map column that has a timestamp as the key.

Example

  1. Create a table containing a map whose key is a timestamp:
    CREATE COLUMNFAMILY t (userid text PRIMARY KEY, todo map<timestamp, text>);

  2. Insert values into the newly-created table.
    INSERT INTO t (userid, todo) VALUES ('a', {'2013-09-22T12:01:00.000+0000': 'text'});

  3. Once the insert operation succeeds, query the map column:
    SELECT userid, todo FROM t;


    The Snap displays the following exception:

    com.datastax.driver.core.exceptions.CodecNotFoundException:
    Codec not found for requested operation: [timestamp <-> java.sql.Timestamp]

Known Issues:The Cassandra Select Snap supports inet Data Type that stores the IP address values. Upon validation, the Snap must display a blank space followed by the corresponding IP address value in its output view, which is the expected behavior. But, in the 4.24 Release, this Snap incorrectly displays empty string as null for inet Data Type followed by the IP address value in its output view.
Account: 

This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Configuring Cassandra Accounts for information on setting up this type of account.

Views:
InputThis Snap has at most one document input view. If the input view is defined, then the where clause can substitute incoming values for a given expression.
OutputThis Snap has at most two document output views.
ErrorThis Snap has at most one document error view and produces zero or more documents in the view.

Settings

Label


Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline.

Schema name


The database schema name. In case it is not defined, then the suggestion for the table name will retrieve all tables names of all schemas. The property is suggestible and will retrieve available database schemas during suggest values.

ExampleSYS

Default value:  [None]

Table Name

Required. The name of table to execute select query on.
Examplepeople

Default value:  [None]

Where clause 

WHERE clause of SELECT statement. The value to be used in the WHERE clause will be used here. Document value substitutions (such as $person.firstname with the value found in the incoming document at the path) can also be used as needed. The "=" will not need to be checked when using document value substitutions unless using expression language.

Examples

Without using expressions

Using expressions

  • "EMPNO=$EMPNO and ENAME=$EMPNAME"

  • email = $email 

  • emp=$emp

  • "emp='" + $emp + "'"

  • "EMPNO=" + $EMPNO + " and ENAME='" + $EMPNAME+ "'"

Caution

Using expressions that join strings together to create SQL queries or conditions has a potential SQL injection risk and is hence unsafe. Ensure that you understand all implications and risks involved before using concatenation of strings with '=' Expression enabled. 

Default value:  [None]

The Where clause property does not support passing Pipeline parameters or passing upstream parameters.

Order by: Column names 

Enter in the columns in the order in which you want to order by. The default database sort order will be used.

Example

name
email 

Default value:  [None]

Output fields

Enter or select output field names for SQL SELECT statement. To select all fields, leave it at default.

Example: email, address, first, last, etc.

Default value[None]

Fetch Output Fields In Schema

Select this check box to include only the selected fields or columns in the Output Schema (second output view). If you do not provide any Output fields, all the columns are visible in the output.
If you provide output fields, we recommend you to select Fetch Output Fields In Schema check box.

Default value: Not selected

Pass through

If checked, the input document will be passed through to the output view under the key 'original'.

Default value: Selected

Number of retries

Specifies the maximum number of attempts to be made to receive a response. The request is terminated if the attempts do not result in a response.

Example: 3

Default value: 0

If the value is larger than 0, the Snap first downloads the target file into a temporary local file. If any error occurs during the download, the Snap waits for the time specified in the Retry interval and attempts to download the file again from the beginning. When the download is successful, the Snap streams the data from the temporary file to the downstream Pipeline. All temporary local files are deleted when they are no longer needed.

Ensure that the local drive has sufficient free disk space to store the temporary local file.

Retry interval (seconds)

Specifies the time interval between two successive retry requests. A retry happens only when the previous attempt resulted in an exception. 

Example:  10

Default value: 1

Staging mode

Required when the value in the Number of retries field is greater than 0. 

Specify the location from the following options to store input documents between retries:

  • In memory: The query results are stored in the Snaplex memory. If the query is too large to fit in the memory space, it may cause the Snap to fail, choose the On disk option.
  • On disk: The query results are stored on the disk in a temporary (tmp) directory that is managed by the SnapLogic platform. This directory is deleted automatically when the Snap terminates.

Snap Execution

Select one of the following three modes in which the Snap executes:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.

  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.

  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default ValueExecute only
Example: Validate & Execute

  

For the 'Suggest' in the Order by columns and the Output fields properties, the value of the Table name property should be an actual table name instead of an expression. If it is an expression, it will display an error message "Could not evaluate accessor:  ..." when the 'Suggest' button is clicked. This is because, at the time the "Suggest" button is clicked, the input document is not available for the Snap to evaluate the expression in the Table name property. The input document is available to the Snap only during the preview or execution time.

Troubleshooting


  • Run Cassandra JDBC driver using another JDBC tool to verify syntax and results.

Examples


Passing values in Where clause property with Expressions:

Passing values in Where clause property without Expressions:


Snap Pack History

 Click to view/expand
Release Snap Pack VersionDateType  Updates
August 2024main27765 StableUpdated and certified against the current Snaplogic Platform release.
May 2024main26341 StableUpdated and certified against the current SnapLogic Platform release.
February 2024436patches25597 -

Upgraded the jOOQ library of the Cassandra Snap Pack from v3.9.1 to v3.17.x.

This upgrade is currently NOT available with the latest distribution. However, you can still consume this patch through 436patches25597. This update is scheduled to be included in the latest distribution release on April 10, 2024, and will be a part of the stable distribution with the GA release on May 8. 2024.

Behavior change:

The jOOQ upgrade for Cassandra Snap Pack done as part of 436patches25597 resulted in the following behavior changes:

  • Previously, when TTL (time to live) was queried using a Select statement without specifying it during data insertion or update, the Cassandra Snaps would display '0'. Now, they return 'null' in such cases.

  • Previously, the null values were stored as ‘0' in the INT datatype columns, now they are stored as 'null’.

February 2024main25112 StableUpdated and certified against the current SnapLogic Platform release.
November 2023main23721 StableUpdated and certified against the current SnapLogic Platform release.

August 2023

main22460

 


Stable

The Cassandra - Execute Snap now includes a new Query type field. When Auto is selected, the Snap tries to determine the query type automatically.

May 2023main21015 StableUpgraded with the latest SnapLogic Platform release.

February 2023

main19844

   

Stable

Upgraded with the latest SnapLogic Platform release.

November 2022main18944 StableUpgraded with the latest SnapLogic Platform release.
August 2022main17386 StableUpgraded with the latest SnapLogic Platform release.
4.29main15993 Stable

Upgraded with the latest SnapLogic Platform release.

4.28main14627 StableUpgraded with the latest SnapLogic Platform release.

4.27

main12833

 

Stable

Upgraded with the latest SnapLogic Platform release.
4.26main11181 StableUpgraded with the latest SnapLogic Platform release.
4.25main9554
 
StableUpgraded with the latest SnapLogic Platform release.
4.24main8556
Stable

Enhanced the Cassandra - Select Snap to return only the fields (provided in the Output Fields) in the output schema (second output view), through a new checkbox Fetch Output Fields In Schema. If the Output Fields property is empty all the columns are visible.

4.23main7430
 
StableUpgraded with the latest SnapLogic Platform release.
4.22main6403
 
Stable
  • Introduces a new account type Cassandra SSL/TLS Database account. Enhances encryption by ensuring data is transferred securely. 
  • Enhances both the account types to enable expressions for required fields to support dynamic account. 
4.21 Patch421patches6272 Latest

Fixed the issue where Snowflake SCD2 Snap generates two output documents despite no changes to Cause-historization fields with DATE, TIME and TIMESTAMP Snowflake data types, and with Ignore unchanged rows field selected.

4.21 Patch421patches6144 Latest

Fixed the following issues with DB Snaps:

  • The connection thread waits indefinitely causing the subsequent connection requests to become unresponsive.
  • Connection leaks occur during Pipeline execution.
4.21 PatchMULTIPLE8841 Latest

Fixed the connection issue in Database Snaps by detecting and closing open connections after the Snap execution ends.

4.21snapsmrc542

 

Stable

Extended support to Cassandra version 3.11.5.

4.20snapsmrc535
 
StableUpgraded with the latest SnapLogic Platform release.
4.19snaprsmrc528
 
StableUpgraded with the latest SnapLogic Platform release.
4.18snapsmrc523
 
StableUpgraded with the latest SnapLogic Platform release.
4.17ALL7402
 
Latest

Pushed automatic rebuild of the latest version of each Snap Pack to SnapLogic UAT and Elastic servers.

4.17snapsmrc515
 
Latest
  • Fixed an issue with the Cassandra Execute Snap wherein the Snap would send the input document to the output view even if the Pass through field is not selected in the Snap configuration. With this fix, the Snap sends the input document to the output view, under the key original, only if you select the Pass through field.
  • Added the Snap Execution field to all Standard-mode Snaps. In some Snaps, this field replaces the existing Execute during preview check box.
4.16 Patch db/cassandra6848 Latest

Fixed an issue with the Cassandra Execute Snap wherein output documents were not produced on selecting the Pass through property.

4.16snapsmrc508
 
StableUpgraded with the latest SnapLogic Platform release.
4.15 Patch db/cassandra6329  Latest

Replaced Max idle time and Idle connection test period properties with Max life time and Idle Timeout properties respectively, in the Account configuration. The new properties fix the connection release issues that were occurring due to default/restricted DB Account settings.

4.15snapsmrc500
 
StableUpgraded with the latest SnapLogic Platform release.
4.14snapsmrc490
 
StableUpgraded with the latest SnapLogic Platform release.
4.13

snapsmrc486

 
StableUpgraded with the latest SnapLogic Platform release.
4.12

snapsmrc480

 
StableUpgraded with the latest SnapLogic Platform release.
4.11snapsmrc465
 
Stable

Where clause property updated to support values containing upstream parameters and Pipeline parameters.

4.10

snapsmrc414

 
StableUpgraded with the latest SnapLogic Platform release.
4.9 Patchcassandra3067 Latest

Fixed an issue regarding connection not closed after login failure; Expose autocommit for "Select into" statement in PostgreSQL Execute Snap and Redshift Execute Snap.

4.9snapsmrc405
 
StableUpgraded with the latest SnapLogic Platform release.
4.8 Patchcassandra2751

Potential fix for JDBC deadlock issue.

4.8

snapsmrc398

 
Stable
  • Info tab added to accounts.
  • Database accounts now invalidate connection pools if account properties are modified and login attempts fail.
4.7.0 Patchcassandra2197 Latest

Fixed an issue for database Select Snaps regarding Limit rows not supporting an empty string from a pipeline parameter.

4.7

snapsmrc382

 
StableUpgraded with the latest SnapLogic Platform release.
4.6cassandra1620
 
Stable
  • Resolved an issue in the Cassandra Select Snap unexpectedly failing with a Failure: 0 error.
  • Resolved an issue in the Cassandra Select Snap that caused unexpectedly failure for valid SQL queries.
  • Resolved an an issue in the Cassandra Select Snap that caused correctly configured Snaps to fail while execution.
4.5.1

snapsmrc344

 
StableUpgraded with the latest SnapLogic Platform release.
4.4.1NA StableUpgraded with the latest SnapLogic Platform release.
4.4NA StableUpgraded with the latest SnapLogic Platform release.
4.3.2NA Stable
  • Resolved an issue with Execute and Select Snaps failing when querying table with user-defined types (UDT).
  • Resolved an issue when ordering db column names using TreeMap versus HashMap caused Cassandra's use of emptyString fields to break.