Changing table name in data warehouse



This might be a very basic question with a simple solution but so far I could not find it.


We have a table in our data warehouse called dim_organizations which is being used by around 50 different looks across our organization. We want to rename the table to dim_active_partners.


Is there an easy way to make this transition without having to rebuild all 50 looks?

3 replies

Userlevel 2

Hi ShayLevy!


There is a Looker IDE function that will help: Looker - Find and Replace LookML


Additionally, I would like to share what happens when your DBA updates the SQL Table Name for you and you didn't modify the code…


For instance:


ALTER TABLE IF EXISTS public.store_revenue_current
RENAME TO store_revenue_current_changed;


Then, looker production and development mode…



Now we need to update our LookML code because we should not keep our production dashboard down 😁. In this example only the SQL tablename changed:

Table name Version before DBA update: public.store_revenue_current

Table name Version after DBA update: public.store_revenue_current_changed


So, in Looker we need to perform these steps: 




Save the changes and deploy to production…


Now, I suggest using the following option in the dashboard  to get fresh information: Looker- Clear Cache



Presto! Our dashboard is now working as normal.


Considerations: When combining Upper and lower characters in SQL, you may need to add double quotes, it totally depends on the new SQL table name saved in your Data Warehouse


Hope it helps




Thank you very much Leo! This is super helpful!

Userlevel 3

I use constant to make sure there are no omissions.😀


# manifest.lkml
constant: table_store_revenue_current { value: "public.store_revenue_current" }

constant: table_store_revenue_current { value: "public.store_revenue_current_changed" }
# store_revenue_current.view
sql_table_name: @{table_store_revenue_current} ;;