Alternative solution to RENAME table

Why Do We Have This Card:

The purpose of the RENAME TABLE statement is to allow users to change the name of an existing table in a database. This functionality can be valuable for tasks such as data model refactoring, naming conventions etc.

Currently, in order to rename a table, the available method is to delete the table and recreate it with the desired name, as the RENAME TABLE command is not yet supported.

However, there is a more optimal solution available. By creating a VIEW (for reference, see the documentation), the required maintenance efforts are minimized and unnecessary data ingestion is avoided, particularly for large tables.

Steps:

  1. Create a view on top of the original table.
CREATE VIEW [IF NOT EXISTS] <view_name>AS SELECT <select_statement>

  1. Direct queries to use the VIEW instead of the original table name.

By following this simple step we will be able to use the new name by querying the VIEW.