Snowflake Alter Function Rename

Justin Aug 25, 2026

Have you ever found yourself designing a complex Snowflake schema only to realize that some functions could be named more appropriately? Fear not! Renaming functions in Snowflake is a straightforward task that can help improve your data model's readability and maintainability. In this guide, we will explore the 'ALTER FUNCTION RENAME' command, its syntax, and its practical use cases.

Snowflake Method: 8 Easy Steps + Free Templates | Imagine Forest
Snowflake Method: 8 Easy Steps + Free Templates | Imagine Forest

Before we dive into renaming functions, let's briefly recap how functions are created in Snowflake. When you create a function, Snowflake automatically assigns a name to it. However, you can also specify a name explicitly during creation. Now, let's see how you can change this name when the need arises.

a snowflake and a bowl of cereal are shown in the opposite words,
a snowflake and a bowl of cereal are shown in the opposite words,

Understanding the ALTER FUNCTION RENAME Command

The ALTER FUNCTION RENAME command allows you to change the name of an existing function. Just like the function creation command, RENAME has a specific syntax that needs to be followed. Let's break down the command to understand how it works.

Making a Name Snowflake
Making a Name Snowflake

At its core, the command has two main components: the existing function name and the new function name. By providing these two pieces of information, you can instruct Snowflake to rename your function. Here's the basic structure of the command:

Command Structure

the diagram shows how to use different shapes and sizes for an object that looks like snowflakes
the diagram shows how to use different shapes and sizes for an object that looks like snowflakes

The ALTER FUNCTION RENAME command follows this structure:

ALTER FUNCTION old_name RENAME TO new_name;

As you can see, the command starts with 'ALTER FUNCTION' followed by the name of the function you want to rename ( denoted as 'old_name' ), and finally, 'RENAME TO' followed by the new desired name ( 'new_name' ).

Snowflake
Snowflake

Creating and Renaming a Function

To illustrate how the ALTER FUNCTION RENAME command works, let's create a simple function and rename it. Below is an example of creating a function named 'add_numbers' and renaming it to 'sum_values':

CREATE OR REPLACE FUNCTION add_numbers(a number, b number) RETURNS NUMBER LANGUAGE JAVASCRIPT AS $$ return a + b; $$; -- Renaming the function ALTER FUNCTION add_numbers RENAME TO sum_values;
Writing Method: Snowflake by Randy Ingermanson (Printable Summaries)
Writing Method: Snowflake by Randy Ingermanson (Printable Summaries)

In this example, we first create a function named 'add_numbers' using the 'CREATE OR REPLACE FUNCTION' command. Then, we use the 'ALTER FUNCTION RENAME' command to rename the same function to 'sum_values'.

Best Practices for Renaming Functions

a snowflake is shown in the foreground
a snowflake is shown in the foreground
a snowflake ornament hanging from a string in the snow with lights behind it
a snowflake ornament hanging from a string in the snow with lights behind it
a poster with instructions on how to make a secret message snowflake
a poster with instructions on how to make a secret message snowflake
two snowflakes are shown in blue and white, with the reflection of them
two snowflakes are shown in blue and white, with the reflection of them
a snowflake is shown in black and white
a snowflake is shown in black and white
a blue and white poster with information about snowflakes in english, spanish, and
a blue and white poster with information about snowflakes in english, spanish, and
Star Schema vs Snowflake Schema – Difference Between Them
Star Schema vs Snowflake Schema – Difference Between Them

While the 'ALTER FUNCTION RENAME' command is straightforward to use, it's essential to follow some best practices to ensure a smooth renaming process.

Choose Descriptive Names

When renaming functions, always choose names that accurately describe what the function does. In contrast to the 'add_numbers' example, using something generic like 'func1' is not a good practice, as it doesn't convey the function's purpose.

Communicate with Your Team

If you're renaming functions that are part of a shared schema, it's crucial to communicate these changes with your team. This helps prevent any confusion and ensures that everyone is on the same page regarding the naming conventions.

Test After Renaming

After renaming a function, always test it to ensure it still works as expected. In some cases, renaming a function might inadvertently break existing queries or procedures that rely on the old function name.

In conclusion, the 'ALTER FUNCTION RENAME' command is a powerful tool that enables you to rename functions in Snowflake. By following the best practices mentioned above and staying vigilant while renaming, you can improve your data model's readability and maintainability. Happy renaming!