Versions Compared

Key

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

In this article

Table of Contents
maxLevel2
absoluteUrltrue

...

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 SelectFetch Sales Data
Get preview dataCheckbox

Multiexcerpt include macro
namegetpreviewdata
pageELT Intersect

Note

If you have selected this field, then you must ensure that the database name is also provided, either in the Snap's Database Name field or in the Account. Otherwise, the Snap's output contains only the SQL built using the Snap. This does not indicate that the SQL is correct. 


Not selectedSelected
Database NameString

The name of the database in which the target/source tables are located. Leave it blank to use the database name specified in the account settings.

Note

You must ensure that the database name is correct. Otherwise, even though the Snap builds an SQL query, you will receive an error when executing the Snap since the query executes only in the target database.  

If your target database is Databricks Lakehouse Platform (DLP), you can, alternatively, mention the file format type for your table path in this field. For example, DELTA, CSV, JSON, ORC, AVRO. See Table Path Management for DLP section below to understand the Snap's behavior towards table paths.

N/A

TESTDB

DELTA

ORC

Schema Name (Not applicable to Databricks Lakehouse Platform)String

The name of the database schema. In case it is not defined, then the suggestion for the table name retrieves all tables names of all schema in the specified database (except for DLP) when you click Image Modified.

Note
  • Ensure that you include the exactly same schema name including the double quotes, if used, when you repeat the schema name in the Table Name field.
  • Leave this field blank if your target database is Databricks Lakehouse Platform.


N/APUBLIC
Table NameString

The name of the table or view for which you want to build the SQL queries. In case If it is not defined, then the Snap retrieves all the table names and views associated with the specified schema when you click click Image Modified 

Multiexcerpt include macro
nameME_Schema_And_Table_Names
pageELT Insert-Select

If your target database is Databricks Lakehouse Platform (DLP), you can, alternatively, mention include the table path in this field. For example, `/mnt/elt/mytabletarget`. See  Learn more about the Snap’s behavior toward paths in the Table Path Management for DLP section to understand the Snap's behavior towards table paths.

Note

When your target database is BigQuery, this Snap supports wildcard search in this field. For  

Learn more information on wildcard search , see in BigQuery: Querying wildcard tables.


N/A

PUBLIC.EMPLOYEES

`/mnt/elt/emp`

Enable SQL query editorCheckbox

Select this to enable the SQL query editor. You can use this editor to build all types of SQL queries that will execute on multiple tables. Enabling the SQL query editor activates the fieldset Input View to Virtual Table Map in the Snap.

Note
  • To perform operations upon multiple tables, you must pass the table names through upstream Snaps. Specify each table name in a separate input view.
  • You must be careful when phrasing the query to prevent SQL injection. See Preventing SQL Injection for details. 


Not selectedSelected
Input View to Virtual Table Map

Activates when you select the Enable SQL query editor checkbox. This is useful when you enable multiple input views in the ELT Select Snap. Use this field set to map each input view to a dummy table. You will reference the table name specified in each input view with this dummy/virtual table name. 

Note
  • Each input view corresponds to the SQL coming from the upstream Snap and that SQL is referenced by the dummy table name.
  • Virtual table name columns must not have duplicates.
  • One input view must not be associated with different table names. 

Click + to add rows. Each input view must be specified in a separate row.

This field set consists of the following fields:

  • Input View
  • Virtual Table Name
Input ViewStringSelect the input view whose table reference is to be mapped.N/Ainput2
Virtual Table NameStringSpecify the dummy/virtual table name that will be assigned to the table reference in the selected input view. N/Atbl1
SQL Query EditorQuery editor

Enter the SQL queries that you want to build using this Snap. Even though the Snap's name is ELT Select, you can use this SQL query editor to build any SQL query.

Info
titleSQL Comments are allowed

You can include inline comments and multi-line comments before, inside, or after your statement in this editor. It supports all standard SQL comment syntaxes as listed below:

-- comment text# comment text/* multi-line
comment text */
// comment text



N/ASELECT DISTINCT  FROM MYTABLE

...

Method-2: Dynamic Substitutions

You must enable expressions when referencing table names using Pipeline parameters. Format the query, except the Pipeline parameter's reference, as a string. 

For example, if you you want to write a SELECT query to fetch records from a table and you are passing the table's name in the Pipeline parameter table:

Code Block
"SELECT * FROM" + _table

In the example above, you must still use JSON-paths if you want to use another Pipeline parameter for substituting values in the SQL:

Code Block
"SELECT * FROM " + _table + " WHERE colname = _name"

...

Note
titleUsing escape characters

When expressions are disabled, use \ as an escape character to treat underscore (_) as a string.

For example:

SELECT \_2, \_3 FROM mytable WHERE colname = \_name 

Troubleshooting

ErrorReasonResolution

Database cannot be blank.

(when seeking the suggested list for Schema Name field)

Suggestions in the Schema Name and Target Table Name fields do not work when you have not specified a valid value for the Database Name field in this Snap.

Specify the target Database Name in this Snap to view and choose from a suggested list in the Schema Name and Target Table Name fields respectively.

SQL exception from Snowflake: Syntax error in one or more positions in the SQL query.
Column names in Snowflake tables are case-sensitive. It stores all columns in uppercase unless they are surrounded by quotes during the time of creation in which case, the exact case is preserved. See, Identifier Requirements — Snowflake Documentation.Ensure that you follow the same casing for the column table names across the Pipeline.

Database encountered an error during preview processing

(Target CDW: BigQuery)

This can happen when the target database cannot recognize/interpret the table name.Ensure that the table name is valid and the table with provided name exists. Using a wildcard in the SQL editor mode, ensure that the table name is enclosed between backticks (`). For example: `scd*`, `mode*`.

Examples

Multiexcerpt include macro
namelimitselect
pageELT Limit

...