On this Page
Table of Contents | ||||
---|---|---|---|---|
|
Snap type: | Write | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description: | This Snap allows you to execute arbitrary SQL.
This Snap supports SQL Server 2008 or newer. Valid JSON paths that are defined in the WHERE clause for queries/statements will be substituted with values from an incoming document. Documents will be written to the error view if the document is missing a value to be substituted into the query/statement. If a SELECT query is executed, the query's results are merged into the incoming document and any existing keys will have their values overwritten. On the other hand, the original document is written if there are no results from the query. If an output view is available and an UPDATE/INSERT/MERGE/DELETE statement was executed, then the original document that was used to create the statement will be output with the status of the statement executed. Expected upstream Snaps: The dynamic variables used in the execute query can be defined by providing values upstream. The document generator Snaps like JSON Generator can be used in upstream. Expected downstream Snaps: The Snap will output one document for every record retrieved, hence any document processing Snap can be used downstream.
Modes
| |||||||||||||||||||||||||||||||||
Prerequisites: | [None] | |||||||||||||||||||||||||||||||||
Limitations and Known Issues: | When the SQL statement property is an expression, the pipeline parameters are shown in the suggest, but not the input schema. | |||||||||||||||||||||||||||||||||
Behavior Change |
| |||||||||||||||||||||||||||||||||
Configurations: | Account & AccessThis Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Azure SQL Account for information on setting up this type of account. Views
| |||||||||||||||||||||||||||||||||
Troubleshooting: | None | |||||||||||||||||||||||||||||||||
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. | |||||||||||||||||||||||||||||||||
SQL statement* | Specifiy the SQL statement to execute on the server. There are two possible scenarios that you encounter when working with SQL statements in SnapLogic.
Examples:
Default value: [None] | |||||||||||||||||||||||||||||||||
Pass through | If selected, the input document will be passed through to the output view under the key 'original'. This property applies only to the Execute Snaps with SELECT statement. 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 | |||||||||||||||||||||||||||||||||
Auto commit | Select one of the options for this property to override the state of the Auto commit property on the account. The Auto commit at the Snap-level has three values: True, False, and Use account setting. The expected functionality for these modes are:
Default value: Use account setting
| |||||||||||||||||||||||||||||||||
|
|
Basic Use Case
The following pipeline describes how the Snap functions as a standalone Snap in a pipeline:
- Extract: The SQL statement, select * from <table_name>, extracts the Azure table data.
Typical Snap Configurations
The key configuration of the Snap lies in how you pass the SQL statement to read Azure records. As it applies in SnapLogic, you can pass SQL statements in the following manner:
Without Expression: Directly passing the required SQL statement in the Azure SQL Execute Snap.
With Expressions
- Values from an upstream Snap: JSON Generator Snap passing the values to be inserted on to the table on Azure.
- Pipeline Parameter: Pipeline parameter set to pass the required values to the Azure.
Use Case
The following describes a pipeline, with a broader business logic involving the ETL transformations, that shows how typically in an enterprise environment, an execute functionality is used. Pipeline download link below.
This pipeline reads and moves files from the SQL Server Database to the Azure SQL Database and the Azure SQL Execute Snap reads the newly loaded table on the Azure SQL instance.
Extract: The SQL Server Select Snap reads the data from the SQL Server Database.
Load: The Azure SQL Execute Snap inserts the data into a Azure SQL table.
Read: Another Execute Snap is used to read the data from the newly loaded table on the Azure SQL database.
Downloads
Multiexcerpt include macro name download_instructions page OpenAPI
Attachments | ||||||
---|---|---|---|---|---|---|
|
Insert excerpt | ||||||
---|---|---|---|---|---|---|
|