Changing table name in data warehouse

Hello,

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?

0 3 474
3 REPLIES 3

leobardor
Participant V

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…

9ceeadfb-2aaf-406d-ae8f-22a9ff4037aa.png

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: 

52865918-dc03-48e9-b6d0-078f86a86294.png
db68915f-6008-440d-a117-f1d769028deb.png

Save the changes and deploy to production…

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

2e5966e3-b2fc-497e-abf9-fa56f7c05a6a.png

Presto! Our dashboard is now working as normal.

005a9ca7-0850-41cf-8ce9-56e3b81db4db.png

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

Best,

Leo

Thank you very much Leo! This is super helpful!

masutaka
Participant IV

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} ;;
Top Labels in this Space
Top Solution Authors