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

Rows Affected by Last Snowflake SQL Query – Example

Many modern databases such as Teradata, SQL Server, etc. support system variables to get rows affected by the last DML command. Then the row count is used to make certain decision to continue execution or abort it. Snowflake scripting provides system variables that hold the information of records affected by an INSERT, UPDATE or DELETE queries in the current session. In this article, we will check how to get rows affected by last Snowflake SQL Query. Rows Affected by Last Snowflake DML Statement Rows Affected by Last Snowflake SQL Query After each DML command is…

Continue ReadingRows Affected by Last Snowflake SQL Query – Example
Comments Off on Rows Affected by Last Snowflake SQL Query – Example

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

Snowflake Scripting Cursor Syntax and Examples

In my other article, we have discussed Snowflake scripting control structures and loops to manipulate Snowflake data. In this article, let us discuss how to define and use the Snowflake scripting cursor within a stored procedure and anonymous block. Snowflake also support JavaScript to write stored procedures, but it does not support cursor when JavaScript used. You can use the JavaScript result as a cursor alternative. Page Content Introduction Understanding Cursors in Snowflake How use Cursors in Snowflake Scripting? Declaring Cursors Opening Cursors Fetching Data from Cursors Closing Cursors Snowflake…

Continue ReadingSnowflake Scripting Cursor Syntax and Examples
2 Comments

Snowflake Scripting Control Structures – IF, WHILE, FOR, REPEAT, LOOP

In my other Snowflake article, we have checked how JavaScript control structure works in Snowflake JavaScript stored procedures. In this article, we will check Snowflake scripting control structures such as IF, WHILE, FOR, REPEAT and LOOP. Snowflake Scripting Control Structures Snowflake Scripting Control Structures The best part about Snowflake is it supports both SQL and JavaScript as a programming language to write stored procedures and user defined functions. Till now, it was supported only JavaScript to write stored procedures, but now they started supporting Snowflake script much similar to PL/SQL…

Continue ReadingSnowflake Scripting Control Structures – IF, WHILE, FOR, REPEAT, LOOP
2 Comments

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