Snowflake - Select
Overview
You can use this Snap 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.

Read-type Snap
-
Works in Ultra Tasks. However, we recommend that you not use this Snap in an Ultra Pipeline
Prerequisites
You must have minimum permissions on the database to execute Snowflake Snaps. To understand if you already have them, you must retrieve the current set of permissions. The following commands enable you to retrieve those permissions:
SHOW GRANTS ON DATABASE <database_name>
SHOW GRANTS ON SCHEMA <schema_name>
SHOW GRANTS TO USER <user_name>
- Usage (DB and Schema): Privilege to use the database, role, and schema.
grant usage on database <database_name> to role <role_name>;
grant usage on schema <database_name>.<schema_name>;
Learn more about Snowflake privileges: Access Control Privileges.
This Snap uses the SELECT command internally. It enables you to query the database and retrieve a set of rows.
Known Issues
Because of performance issues, all Snowflake Snaps now ignore the Cancel queued queries when pipeline is stopped or if it fails option for Manage Queued Queries, even when selected. Snaps behave as though the default Continue to execute queued queries when the Pipeline is stopped or if it fails option were selected.
Behaviour Change
From 4.30 Release, the Snowflake - Select Snap writes the output value as-is for FLOAT or DOUBLE datatype columns if these columns have the value as NaN (Not a Number). Earlier, the Snap displayed an exception error when the FLOAT or DOUBLE datatype column has the value as NaN. This behavior is not backward compatible.
Snap views
View | Description | Examples of upstream and downstream Snaps |
---|---|---|
Input |
A document that provides values for one or more properties of the Snap or for pass-through purpose. 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. |
|
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. The Snap
will output one document for every record retrieved, hence any document processing
Snap can be used downstream. Document 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. Queries produced by the Snap have an equivalent format: SELECT * FROM [table] WHERE [where clause] ORDER BY [ordering] LIMIT [limit] OFFSET [offset] |
|
Error |
Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:
Learn more about Error handling in Pipelines. |
Snap settings
- Expression icon (
): Allows using JavaScript syntax to access SnapLogic Expressions to set field values dynamically (if enabled). If disabled, you can provide a static value. Learn more.
- SnapGPT (
): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
- Suggestion icon (
): Populates a list of values dynamically based on your Snap configuration. You can select only one attribute at a time using the icon. Type into the field if it supports a comma-separated list of values.
- Upload
: Uploads files. Learn more.
Field / Field set | Type | Description |
---|---|---|
Label | String | Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if there are more than one of the same Snap in the pipeline. |
Schema Name | String/Expression | Specify the database schema name. In case it is not defined, then the
suggestion for the Table Name retrieves all tables names of all schemas. The
property is suggestible and will retrieve available database schemas during suggest
values. Note: The values can be passed using the pipeline parameters but not the
upstream parameter. Default value: N/A Example: Schema_demo |
Table Name | String/Expression | Required. Specify the name of the table to execute Select
query on. Default value: N/A Example: employees_table |
Where Clause | String/Expression | 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). Default value: N/A Example: ID in (48,50) |
Order By | Use this fieldset to specify the columns in the order in which you want to sort the database. The default database sort order will be used. | |
Column names | String/Expression | Specify the column names. Default value: N/A Example: email |
Time travel props | Use this field set to configure the time travel clause. | |
Key Columns | Dropdown list | Choose the key column for the query. The available options are:
Learn more about the time travel properties. Default value: N/A Example: email |
Value Column | String/Expression | Specify the value for the corresponding key column. Default value: N/A Example: -60*5 |
Limit offset | Integer/Expression | Specify the offset for the limit clause. This is where the result set should
start. Default value: N/A Example: 0 |
Limit rows | Integer/Expression | Specify the number of rows to return from the query. Default value: N/A Example: 10 |
Output fields | String/Expression | Enter or select output fields for Snowflake SQL SELECT statement. To select all
fields, leave it at default. Default value: N/A Example: email |
Fetch Output Fields In Schema | Checkbox | Select this checkbox 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 checkbox. Default status: Deselected |
Pass through | Checkbox | Select this checkbox to enable the Snap to pass the input document to the
output view under the key named original . This option applies only
to the Execute Snaps with SELECT statement. Default status: Selected |
Ignore empty result | Checkbox | Select this checkbox to not write any document to the output view when a SELECT
operation does not produce any result. If this checkbox is not selected and the
Pass-through checkbox is selected, the input document is passed through to the
output view. Default status: Deselected |
Match data types | Checkbox |
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 status: Deselected |
Number of retries | Integer/Expression | 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. 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. Minimum Value: 0 Note: Ensure that the
local drive has sufficient free disk space to store the temporary local
file. Default value: 0 Example: 3 |
Retry interval (seconds) | Integer/Expression | Specifies 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 | Dropdown list | 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:
|
Handle Timestamp and Date Time Data | Dropdown list | Choose an option for handling timestamp and date time data. The available
options are:
Note:
Recommendation: If you use the Timestamp TZ and Timestamp LTZ
in this Snap, we recommend you to use SnapLogic Date Time format in Regional
TimeZone to ensure that you get the Timestamp data output of the target
table in the same format as in the source table. Source Table Target Table |
Manage Queued Queries | Dropdown list |
Default value: Select an option to determine 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 type of 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 Example: Cancel queued queries when the pipeline is stopped or if it fails |
Snap execution | Dropdown list | Choose one of the three modes in which the Snap executes. Available options
are:
|
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.