Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

On this Page

Table of Contents
maxLevel2
excludeOlder Versions|Additional Resources|Related Links|Related Information

Snap type:

Read

Description:

This Snap enables you to fetch data from a database by providing a table name and configuring the Snowflake connection. The Snap produces the records from the database on its output view which can then be processed by a downstream Snap. 

JSON paths can be used in a query and will have values from an incoming document substituted into the query. However, documents missing values for a given JSON path will be written to the Snap's error view. After a query is executed, the query's results are merged into the incoming document overwriting any existing keys' values. The original document is output if there are no results from the query.

Queries produced by the Snap have an equivalent format:

Code Block
SELECT * FROM [table] WHERE [where clause] ORDER BY [ordering] LIMIT [limit] OFFSET [offset]


If more powerful functionality is desired, then the Execute Snap should be used.

  • Expected upstream Snaps: A dynamic where clause can be defined by providing values upstream. As the Mapper Snap can provide constants, pipeline parameters mapped into variables then can be used in the where clause or even in the table/schema properties. 
  • Expected downstream Snaps: The Snap will output one document for every record retrieved, hence any document processing Snap can be used downstream. 
  • Expected input: A document that provides values for one or more properties of the Snap or simply for pass-through purpose. 
  • Expected outputDocument for each record retrieved. Special types such as TIMESTAMP, TIME are converted into SnapLogic internal date type representations which then can be consumed by downstream Snaps just like any other data type.
Prerequisites:

Insert excerpt
Snowflake - Bulk Load
Snowflake - Bulk Load
nopaneltrue

Security Prerequisites: You should have the following permissions in your Snowflake account to execute this Snap: 

Usage (DB and Schema): Privilege to use database, role, and schema.

The following commands enable minimum privileges in the Snowflake Console:

Code Block
grant usage on database <database_name> to role <role_name>;
grant usage on schema <database_name>.<schema_name>;

For more information on Snowflake privileges, refer to Access Control Privileges.

Internal SQL Commands

This Snap uses the SELECT command internally. It enables you to query the database and retrieve a set of rows.

Support and limitations:

Works in Ultra Pipelines.

Account: 

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

Views:


Input

This Snap has at most one document input view. 

Output

This Snap has one document output view by default. 

A second view can be added to show the metadata for the table as a Document. The metadata document can then be fed into the second input view of Snowflake - Insert or Bulk Load Snaps so that the table is created in Snowflake with a similar schema as the source table.

Error

This Snap has at most one error view and produces zero or more documents in the view.


Settings

Label*


Specify 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 table names of all schemas. The property is suggestible and will retrieve available database schemas during suggest values.

Table name*

Specify the table to execute the select query on.

Where clause 

Specify the where clause of the SELECT statement. This supports document value substitution (such as $person.firstname will be substituted with the value found in the incoming document at the path).

Order by 

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

Examples

  • name
  • email
Limit offset

Specify the offset for the limit clause. This is where the result set should start.

Limit rows 

Specify the number of rows to return from the query.

Output fields*

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

Fetch Output Fields In Schema

Insert excerpt
Cassandra - Select
Cassandra - Select
nopaneltrue

Default value: Not selected

Pass-through 


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

Default value: Selected

Ignore empty result

If selected, no document will be written to the output view when a SELECT operation does not produce any result. If this property is not selected and the Pass-through property is selected, the input document will be passed through to the output view.

Default value: Not selected

Match data types

Conditional. This field applies only when the Output fields field is provided with any values.

If this checkbox is selected, the Snap tries to match the output data types the same as when the Output fields property is empty (SELECT * FROM ...). The output preview would be in the same format as the one when SELECT * FROM is implied and all the contents of the table are displayed.

Default value: Not selected

Number of Retries

Specify 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.

Default value: 0
Example: 3

Multiexcerpt include macro
nameretries
pageFile Reader

Retry Interval (seconds)

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

Default value: 1
Example:  10

Staging mode

Specify the location where you want the Snap to store in-flight records when using Retry. Valid options are:

  • In memoryRecords are saved in Snaplex memory.
  • On diskRecords are saved in SLDB.

Default valueIn memory

Note

For 0 retries, the Staging mode is disabled.


Handle Timestamp and Date Time Data

Specify how the Snap must handle timestamp and date time data. The available options are:

  • Default Date Time format in UTC Time Zone: The Snowflake date time data are represented in UTC Time Zone.

  • SnapLogic Date Time format in Regional Time Zone: The Snowflake date time data are represented in the same regional time zone value, as provided in the Snowflake account.

Default value: Default Date Time format in UTC Time Zone

Multiexcerpt include macro
nameTimestamp_recommendation
pageSnowflake - Execute

Manage Queued Queries

Select this checkbox to decide whether the Snap should continue or cancel the execution of the queued Snowflake Execute SQL queries when you stop the pipeline.

Note

If you select Cancel queued queries when the pipeline is stopped or if it fails, then the read queries under execution are canceled, whereas the write queries under execution are not canceled. Snowflake internally determines which queries are safe to be canceled and cancels those queries.

Default value: Continue to execute queued queries when the pipeline is stopped or if it fails

Multiexcerpt include macro
nameSnap Execution
pageAnaplan Read

Multiexcerpt include macro
nameSnap_Execution_Introduced
pageAnaplan Read


Note
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. 

Examples


The following example illustrates how to read table data using the Snowflake - Select Snap.

 Image Modified

The above Snap reads test@test table data, and orders the results based on the C1 column. Additionally, it limits the results to only 10 rows. 

Successful execution of the Pipelines gives the following output in the preview: 

Image Modified

Insert excerpt
Snowflake Snap Pack
Snowflake Snap Pack
nopaneltrue