Database Migration to Snowflake: Best Practices and Tips

The Snowflake cloud data warehouse has become widely recognized as a flexible, high-performing, and scalable solution for both data warehousing and analytics needs. This article will explore how to migrate a database to Snowflake cloud data warehouse and also provide insights into some best practices for the migration. Page Content Introduction Preparing for Migration Migrating to Snowflake Best Practices for Database Migration to Snowflake Best Practices for File Sizing and Format Best Practices for Data Transfer Best Practices for Running Source and Snowflake Databases Best Practices for Temporary and Transient…

Continue ReadingDatabase Migration to Snowflake: Best Practices and Tips
Comments Off on Database Migration to Snowflake: Best Practices and Tips

Blocks in Snowflake Scripting – Examples

Snowflake scripting allows you to write procedural code within the Snowflake scripting block. In this article, we will check how to use blocks in a Snowflake scripting. Blocks in Snowflake Scripting Blocks in Snowflake Scripting Block in a Snowflake scripting is defined by a keywords such as DECLARE, BEGIN, EXCEPTION and END. You usually write your procedural code into different part. Structure of Block in a Snowflake Scripting Snowflake scripting block has the following basic structure: DECLARE ... variable declarations, ... ... cursor declarations, etc ... BEGIN ... Snowflake Scripting…

Continue ReadingBlocks in Snowflake Scripting – Examples
Comments Off on Blocks in Snowflake Scripting – Examples

Oracle DML LOG ERROR Alternative in Snowflake

Oracle database supports many user friendly error handling features that make the developer's life easier when working on DML statements such as INSERT, UPDATE, DELETE, MERGE. One of the such features is dml error logging. Using this feature, your DML statements will continue by logging errors in the error table created using the DBMS_ERRLOG package. This feature is not yet available in Snowflake. In this article, we will check Oracle DML LOG ERROR alternative methods in Snowflake scripting. Oracle DML Error Logging With Oracle DML error logging feature, you can…

Continue ReadingOracle DML LOG ERROR Alternative in Snowflake
Comments Off on Oracle DML LOG ERROR Alternative in Snowflake

Snowflake NULL Handling Functions, Usage and Examples

A NULL value in a relational database is a special marker used in SQL to indicate that a data value is UNKNOWN or does not exist in the database. In other words, a NULL value is just a placeholder to denote values that are missing or it is unknown. Snowflake supports NULL handling functions that are available in other cloud data warehouse such as Redshift, Azure Synapse, etc. Along with those, Snowflake also supports many extended functions to handle null values. In this article, we will check Snowflake NULL handling functions, usage and some examples. Snowflake NULL…

Continue ReadingSnowflake NULL Handling Functions, Usage and Examples
Comments Off on Snowflake NULL Handling Functions, Usage and Examples

How to Create View Dynamically in Snowflake?

The best part about Snowflake is that it supports almost all features that are available in any modern data warehouse. One of such a feature is dynamic SQL. You can execute SQL statements dynamically using Snowflake stored procedures. Snowflake supports JavaScript API to write stored procedures and user-defined functions. Note that, there is a difference between Snowflake stored procedure and UDFs. We will use stored procedures to create a view dynamically in Snowflake. Create View Dynamically in Snowflake In a data warehouse application, you will always get requirement to write…

Continue ReadingHow to Create View Dynamically in Snowflake?
Comments Off on How to Create View Dynamically in Snowflake?

How to use Conditional Insert into Snowflake Tables?

Snowflake cloud data warehouse supports many useful features that are not yet available in many other similar databases. One of such features is multi-table INSERT. You can insert one or more rows from query into one or more table. Syntax support both conditional and unconditional inserts. This feature is useful when you are inserting data using some conditions such as insert only positive rows to the particular table. In this article, we will check how to use conditional and unconditional insert into Snowflake tables, its syntax and examples. Conditional and…

Continue ReadingHow to use Conditional Insert into Snowflake Tables?
Comments Off on How to use Conditional Insert into Snowflake Tables?

How to Drop All SQL Variables in Snowflake Session?

Snowflake supports SQL session variable declaration by the user. SQL variable serves many purposes such as storing application specific environmental variables. You can also use SQL variables to create parameterized views or parameterized query. Once the variables are defined, you can explicitly use UNSET command to reset the SQL variables. In this article, we will check how to drop or reset all SQL variables in Snowflake session. Snowflake SQL Variables Before going into methods to reset all SQL variables, let us check how to define a SQL variable and reset…

Continue ReadingHow to Drop All SQL Variables in Snowflake Session?
Comments Off on How to Drop All SQL Variables in Snowflake Session?

Snowflake LIMIT and OFFSET – Uses and Examples

You can use the LIMIT clause in Snowflake to limit the number of results that are returned by the SQL statement or subquery. The LIMIT clause allows you to test your SQL queries with the limited number of rows instead of executing it on the entire data set. In this article, we will check Snowflake LIMIT and OFFSET, syntax, uses and some examples. Snowflake LIMIT and OFFSET The LIMIT clause constrains the maximum number of rows returned by a statement or subquery. It is a PostgreSQL syntax to limit the…

Continue ReadingSnowflake LIMIT and OFFSET – Uses and Examples
Comments Off on Snowflake LIMIT and OFFSET – Uses and Examples

How to Query S3 External Files in Snowflake?

You can integrate the cloud storages, such as AWS S3, Azure Blob and GCP cloud storage with Snowflake cloud data warehouse very easily. Snowflake does support external tables, you can create external tables on the top of the files stored on the external storages such as S3, blob or GCP storage. In this article, we will check how to query S3 external files directly in Snowflake. How to Query S3 External Files in Snowflake? Snowflake Cloud data warehouse supports using standard SQL to query data files located in an internal…

Continue ReadingHow to Query S3 External Files in Snowflake?
Comments Off on How to Query S3 External Files in Snowflake?

How to Get Row Count of Database Tables in Snowflake?

Counting the number of records from the database tables is one of the mandatory checks when you migrate data from one server to another. Snowflake is very rich in metadata information. It captures many useful information such as details about tables, columns, views, etc. In this article, we will write few useful queries to get row count of Snowflake database tables. Get Row Count of Database Tables in Snowflake You can look for object metadata information either in INFROMATION_SCHEMA for a particular database or utilize the ACCOUNT_USAGE that Snowflake provides…

Continue ReadingHow to Get Row Count of Database Tables in Snowflake?
Comments Off on How to Get Row Count of Database Tables in Snowflake?