Aliasing table names in Snowflake

After copying data overnight from SQL Server to Snowflake, I wanted to recreate an SSRS report in Data Studio.

Unfortunately the copied tables all had ‘STG_’ appended to the start of their names (e.g. STG_Customers).

There is nothing like ‘Synonym’ built into Snowflake, and I really, really did not want to go through the legacy query adding ‘STG_’ to the begining of every single table name.

My solution was to create Views as table aliases, as Views in Snowflake are blindingly fast. Here’s the video:-

Additionally, I scheduled creation of the views to run overnight using a ‘task’. This let it “scale” to pick up any new tables. It was easy enough. But if you want to save some time you can buy me a coffee and pick up my code using the link below.

https://richardsmith74.gumroad.com/l/snowflaketablealiasing

Leave a comment