Database Migration to Snowflake: Best Practices and Tips

Moving your legacy data warehouse to the Snowflake Data Cloud is one of the best decisions you can make for performance, scalability, and cost-efficiency. However, migrating from traditional systems like Oracle, Netezza, Teradata, or SQL Server is rarely a simple "lift and shift" operation. Without a solid strategy, you risk data loss, security gaps, and unexpected cloud computing costs. In this guide, we will break down the essential steps for a successful Snowflake migration and the best practices you need to follow to optimize your new environment. Page Content Introduction…

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

How to Create Synonym in Snowflake?

Synonyms in relational databases allows you to create easily names for long table, view names, or any other objects such as sequence, procedure, function, materialized view. Databases such as Netezza, Oracle support creating and managing synonyms. The synonyms provide an alternate way of referencing tables or views that present in the current or other databases. The Snowflake database does not support creating synonym yet. In this article, we will check an alternate method similar to create synonym in Snowflake. How to Create Synonym in Snowflake? The Snowflake cloud database does…

Continue ReadingHow to Create Synonym in Snowflake?
Comments Off on How to Create Synonym in Snowflake?

Rows Affected by Last Snowflake SQL Query – Example

Need to find out how many rows were inserted, updated, or deleted after running a query in Snowflake? Just like other major databases, Snowflake gives you a direct way to track these changes using built-in system variables. Let's look at how you can easily get the rows affected by your last Snowflake SQL query to build better scripts and workflows. Rows Affected by Last Snowflake DML Statement Page Content Introduction Rows Affected by Last Snowflake SQL Query Example: Getting Rows Affected by an INSERT Query Example: Getting Rows Affected by…

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

Blocks in Snowflake Scripting: Complete Guide with Examples

If you are writing procedural code in Snowflake like loops, branching logic, or error handling you will use blocks in Snowflake scripting. A block is the fundamental structure that groups your SQL and programmatic logic together. In this guide, we will break down exactly how to structure a block, the difference between stored procedures and anonymous blocks, and look at fully runnable examples you can use right away. Blocks in Snowflake Scripting Page Contents Blocks in Snowflake Scripting Types of Blocks in Snowflake Scripting Block in a Stored Procedure Anonymous…

Continue ReadingBlocks in Snowflake Scripting: Complete Guide with Examples
Comments Off on Blocks in Snowflake Scripting: Complete Guide with 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 What is Cursor in Snowflake Scripting? How use Cursors in Snowflake Scripting? Declaring Cursors Opening Cursors Fetching Data from Cursors Closing…

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. Snowflake Scripting makes it incredibly easy to manage conditional logic and iterations directly within your stored procedures and anonymous blocks. By mastering Snowflake scripting control structures like IF, WHILE, FOR, REPEAT, and LOOP, you can seamlessly migrate existing PL/SQL logic and build robust data pipelines. Let's dive into how these branching and looping structures work with simple, real-world examples. Snowflake Scripting Control Structures Page Content Introduction Snowflake Scripting Control Structures Branching Structures:…

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

Oracle DML LOG ERROR Alternative in Snowflake

Are you looking for an Oracle DML LOG ERROR alternative in Snowflake? When migrating your databases, you might realize you miss Oracle's native error-logging features. In this post, we will walk through the best workarounds for Snowflake DML error handling so you can seamlessly capture bad records using simple scripting and Snowpark. Page Content Introduction Oracle DML Error Logging Snowflake Script Error Logging to Capture Reject Rows Snowpark Error Handling to Capture Reject Rows Conclusion Introduction Oracle database offers very friendly error handling options that make life easier for developers…

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

How to Find the Most Queried Table in Snowflake (Using ACCESS_HISTORY)

Do you want to optimize your Snowflake data warehouse and identify which datasets drive the most value for your team? Discovering the most queried table in Snowflake is one of the best ways to understand user behavior, audit access, and manage compute costs effectively. Let’s dive into how you can extract this table usage data using native system views. Page Content Introduction Understanding Snowflake System Views The Snowflake ACCESS_HISTORY View Query to Find the Most Queried Table Conclusion Introduction As a fully managed cloud data warehouse solution, Snowflake takes away…

Continue ReadingHow to Find the Most Queried Table in Snowflake (Using ACCESS_HISTORY)
Comments Off on How to Find the Most Queried Table in Snowflake (Using ACCESS_HISTORY)

Snowflake NULL Functions: A Complete Guide with Examples

Working with dirty data is a daily reality for data engineers and analysts, and missing values are one of the most common culprits. Handling these missing values effectively ensures your reporting and analytics remain accurate and reliable. Lets see how to handle these missing data using Snowflake NULL functions. Page Content Introduction Overview of Snowflake NULL Functions Snowflake NVL and NVL2 Functions COALESCE Function in Snowflake IFNULL Function in Snowflake ZEROIFNULL Function in Snowflake NULLIF Function in Snowflake IS NULL and IS NOT NULL Operators EQUAL_NULL Function in Snowflake IS_NULL_VALUE…

Continue ReadingSnowflake NULL Functions: A Complete Guide with Examples
Comments Off on Snowflake NULL Functions: A Complete Guide with 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?