Knowledge Drop

How to overwrite content with Gazer

  • 7 May 2021
  • 0 replies
  • 235 views

Last tested: Mar 25, 2019
 

Gazer is a command line tool for Looker content management. You can use it to overwrite existing content with new content so that the URL of the existing content does not change with the update.

How to do it

Set up:

  • Old dashboard: ID=15, name=Old Dashboard
  • New dashboard: ID=19, name=Renovated Dashboard
  • instance = example.looker.com

Requirements:

  • Both dashboards in the same space

Step by step

  1. Copy the content of the new dashboard into your current directory.
    1. gzr dashboard cat 19 --host=example.looker.com --dir ~
  2. Then you can ls to see the new file: it should have the same name as it does in the instance (that's what "~" does), prepended with "Dashboard_[ID]_". Note that this example "Renovated Dashboard" has a space, which the terminal will store as "\ " in subsequent commands.
  3. Open the new dashboard file in any text editor.
    1. vi Dashboard_19_Renovated\ Dashboard.json
  4. Make 2 changes to the dashboard in the text editor.
    1. Remove the slug.
      1. It will look something like this: "slug": "yBPjFba". Remove the entire line.
      2. A 'slug' is a unique id for an object which is globally unique, not just an integer id which is only unique within its backend db table. Queries, looks, dashboards and other stuff now have slugs as well as integer ids.
    2. Change the dashboard to match the old dashboard name being replaced. If the old name is not desirable, you can change it manually once you're done (either in the terminal or Looker UI).
  5. Import the new dashboard from your machine to Looker. Specify the space and the host.
    1. gzr dashboard import Dashboard_19_Renovated\ Dashboard\.json 445 --host=example.looker.com --force

That's it! Go back to the space and your new content should be over the old content URL. You can delete the new content where it originally existed before we copied it.

 

This content is subject to limited support.                

 


0 replies

Be the first to reply!

Reply