Versions Compared

Key

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

...

...

In this article

Table of Contents
maxLevel2
absoluteUrltrue

Multiexcerpt include
templateData[]
MultiExcerptNameME_OE_ELT_Snap_Accounts
addpanelfalse
PageWithExcerptELT Aggregate

Overview

Use this Snap to add a MINUS SQL operator to the separate queries coming from upstream Snaps. The MINUS SQL operator corresponds to ANSI EXCEPT. In Azure Synapse and BigQuery, this Snap uses the EXCEPT operation unlike in Redshift and Snowflake, where the Snap uses the MINUS operation. This Snap also allows you to preview the result of the MINUS SQL operation on the incoming SQL queries. You can validate the modified query using this preview functionality.
Image Modified

Note
  • The MINUS SQL operation does not eliminate duplicate records. You can add the ELT Unique Snap to the ELT Minus Snap to remove duplicates. 
  • This Snap's output is not commutative. The Snap's output changes based on which table is connected in which input view. For example, if you use queries for tables A and B as inputs, where query A is connected to the first input and query is connected to the second, the result from the Snap's execution would not be the same if it was the other way around. Basically, A MINUS B is not the same as B MINUS A.

Prerequisites

None.

Limitation

Multiexcerpt include macro
nameME_ELT_GBQ_StandardSQL_UOI
pageELT Copy

Known Issues

Multiexcerpt include macro
nameME_ELT_KI_Underscore_Refs
pageELT Snap Pack

Snap Input and Output

Input/OutputType of ViewNumber of ViewsExamples of Upstream and Downstream SnapsDescription
Input 

Document

  • Min: 2
  • Max: No limit
  • ELT Select
  • ELT Aggregate
Multiple SQL queries.
Output

Document

  • Min: 1
  • Max: 1
  • ELT Unique
  • ELT Insert-Select
The incoming SQL queries with the MINUS operator included. 

Snap Settings

Info
titleSQL Functions and Expressions for ELT

You can use the SQL Expressions and Functions supported for ELT to define your Snap or Account settings with the Expression symbol = enabled, where available. This list is common to all target CDWs supported. You can also use other expressions/functions that your target CDW supports.


Parameter NameData TypeDescriptionDefault ValueExample 
LabelString
Insert excerpt
File Writer
File Writer
nopaneltrue
ELT MinusExclude Common Records
Get preview dataCheckbox

Multiexcerpt include macro
namegetpreviewdata
pageELT Intersect

Info

In Azure Synapse and BigQuery, this Snap uses EXCEPT operation unlike in Redshift and Snowflake, wherein the Snap uses MINUS operation.


Output preview in Azure Synapse
Image Modified


Not selectedSelected
Retain duplicates (Databricks Lakehouse Platform only)CheckboxIf your target database is a Databricks Lakehouse Platform instance, select this checkbox to indicate that the Snap can include duplicate entries in its output. Else (by default), the Snap retrieves only unique records from the MINUS/EXCEPT operation result.Not selectedSelected

Troubleshooting

None.

Examples

Retrieving Uncommon Rows From a Table

We need a query with the MINUS operator if we want to compare two tables and retrieve the uncommon records from the first table. This example shows how we can use the ELT Minus Snap to build this query.

Image Modified

First, we build SELECT queries to read the target tables. To do so, we can use two ELT Select Snaps, in this example: Read Part A and Read Part B. Each of these Snaps is configured to output a SELECT * query to read the target table in the database. Additionally, these Snaps are also configured to show a preview of the SELECT query's execution as shown:

Read Part A ConfigurationRead Part B Configuration
Image Modified
Image Modified

A preview of the outputs from the ELT Select Snaps is shown below:

Read Part A OutputRead Part B Output
Image Modified

Image Modified

Then, we connect the ELT Minus Snap to the output view of the ELT Select Snaps. The SELECT * queries in both of these Snaps form the inputs for the ELT Minus Snap. Upon execution, the ELT Minus Snap combines both incoming SELECT * queries and adds the MINUS operator.

A preview of the ELT Minus Snap's output is shown below:

Image Modified

We can also add an ELT Insert-Select Snap downstream and write the result of this query into another table.

Download this Pipeline.

Downloads

Note
titleImportant Steps to Successfully Reuse Pipelines
  1. Download and import the Pipeline into SnapLogic.
  2. Configure Snap accounts as applicable.
  3. Provide Pipeline parameters as applicable.

Attachments
patterns*.slp, *.zip


Insert excerpt
ELT Snap Pack
ELT Snap Pack
nopaneltrue


See Also