Snowflake Set Operators: UNION, EXCEPT/MINUS and INTERSECT

Snowflake set operators are used to combine similar resultset from two or more SELECT statements. The data type of the two or more result sets should also match, otherwise explicit type cast has to be used to convert the result set to required data types. Types of Snowflake Set Operators Cloud data warehouse supports the three types of set operators: UNION and UNION ALLINTERSECT EXCEPT or MINUS Snowflake Set Operators Syntax Below is the syntax of Set operators in Snowflake: query { UNION [ ALL ] | INTERSECT | EXCEPT…

Continue ReadingSnowflake Set Operators: UNION, EXCEPT/MINUS and INTERSECT
Comments Off on Snowflake Set Operators: UNION, EXCEPT/MINUS and INTERSECT

Identify and Remove Duplicate Records from Snowflake Table

Snowflake supports primary, foreign key(s) and unique key(s), but, does not enforce them. Snowflake table allows you to insert duplicate rows. There are chances that some application may insert the records multiple times. There are several methods you can use to de-duplicate the snowflake tables. In this article, we will check how to identify and remove duplicate records from Snowflake table. Remove Duplicate Records from Snowflake Table There are many methods that you can use to remove the duplicate records from the Snowflake table. For example, use the DISTINCT keyword…

Continue ReadingIdentify and Remove Duplicate Records from Snowflake Table
Comments Off on Identify and Remove Duplicate Records from Snowflake Table

Snowflake WITH Clause Syntax, Usage and Examples

Snowflake WITH Clause is an optional clause that always precedes SELECT clause in the query statements or construct. The WITH clause usually contains a sub query that is defined as a temporary table similar to View definition. Each sub query in the WITH clause is associated with the name, an optional list of a column names, and a query that evaluates to a table. The query expression is usually a select statement. In this article, we will check Snowflake WITH clause syntax, usage, types of WITH clause with some examples.…

Continue ReadingSnowflake WITH Clause Syntax, Usage and Examples
Comments Off on Snowflake WITH Clause Syntax, Usage and Examples

Snowflake Regular Expression Functions and Examples

The regular expressions are commonly used functions in programming languages such as Python, Java, R, etc. The Snowflake regular expression functions identify the precise pattern of the characters in given string. Regular expressions are commonly used in validating strings, for example, extracting numbers from the string values, etc. In this article, we will check the supported Regular expression functions in Snowflake. Snowflake Regular Expression Functions The regular expression functions are string functions that match a given regular expression. These functions are commonly called as a 'regex' functions. Below are some…

Continue ReadingSnowflake Regular Expression Functions and Examples
Comments Off on Snowflake Regular Expression Functions and Examples

Teradata ROWNUM Pseudocolumn Alternative and Examples

The relational databases like Oracle supports the ROWNUM pseudo column. If you are from Oracle background, you may have used ROWNUM extensively to limit the output result set. But, There is no ROWNUM in Teradata. In this article, we will check Teradata ROWNUM pseudocolumn alternative with some examples. Teradata ROWNUM Pseudocolumn Alternative A ROWNUM is a pseudo column, which indicates the row number in a result set retrieved by a SQL query. It starts by assigning 1 to the first row and increments the ROWNUM value with each subsequent row returned. In the databases…

Continue ReadingTeradata ROWNUM Pseudocolumn Alternative and Examples
Comments Off on Teradata ROWNUM Pseudocolumn Alternative and Examples

How to Create your own Custom Python Distribution Package?

Python programming language is one of the commonly used programming language in industry. With growing AI/ML, Python popularity is also growing. You may have to use many Python packages to build your application. Ever wondered how to create a Python distribution like Anaconda?. In this article, we will explain how to create your own Python package. You can later install package on the target machine. How to Create your own Python Distribution Package? There are many ways to package your Python application and create a setup.py to install the application…

Continue ReadingHow to Create your own Custom Python Distribution Package?
Comments Off on How to Create your own Custom Python Distribution Package?

How to use Snowflake Python Connector and Example

Snowflake is a cloud data warehouse environment and provides support for many major programming languages that uses JDBC or ODBC drivers. You can use Snowflake provided connector to connect your application. In this article, we will check one of the such connectors. i.e Python connector for Snowflake. Snowflake Python Connector The Snowflake Connector for Python provides an interface for developing Python applications that can connect to cloud data warehouse and perform all standard operations.  The connector is a pure python package that can be used to connect your application to…

Continue ReadingHow to use Snowflake Python Connector and Example
Comments Off on How to use Snowflake Python Connector and Example

Execute SQL Script File using Snowflake Snowsql Variable Substitution

Snowflake allows variable substitution using -D or --variable options. The variable substitution is one of the nice feature that allows you to pass values to the script dynamically. For example, pass month value to the SQL script. Many modern day databases support the variable substitution. In this article, we will check how to a execute SQL script file using Snowflake Snowsql variable substitution with an example. Snowflake Snowsql Variable Substitution Snowsql supports the variable substitution with the help of -D or --variable option. You can use that defined variable inside…

Continue ReadingExecute SQL Script File using Snowflake Snowsql Variable Substitution
Comments Off on Execute SQL Script File using Snowflake Snowsql Variable Substitution

Access Snowflake using Snowsql without Password Prompt – Snowsql Environment Variables

There are many ways you can connect to Snowflake cloud data warehouse server. The options include Snowsql, JDBC and ODBC drivers, python connector, Spark connectors, etc. In this article, we will discuss how to access Snowflake using Snowsql without password prompt. We will also check Snowsql environment variables. Access Snowflake using Snowsql without Password Prompt Password less access is useful when your application requires to connect to Snowflake frequently. There are multiple options that you can use to achieve password less communication to Snowflake server. Export Snowflake Database Server Environmental…

Continue ReadingAccess Snowflake using Snowsql without Password Prompt – Snowsql Environment Variables
Comments Off on Access Snowflake using Snowsql without Password Prompt – Snowsql Environment Variables

Snowsql Command Line Options and Examples

SnowSQL is a Python based command line interface to connect Snowflake from Windows, Linux, and Mac OS. The SnowSQL is an interactive terminal for Snowflake. You can use it to execute queries, create database objects and perform some of the admin tasks. In this article, we will check how to use Snowsql, what are the SnowSQL command line options. Snowsql Command Usage You can use following command to connect to Snowflake using Snowsql. snowsql -a accountName -u userName -d databaseName -s schemaName For example, consider following command to connect Snowflake…

Continue ReadingSnowsql Command Line Options and Examples
Comments Off on Snowsql Command Line Options and Examples