Gazer - A Command Line Tool for Looker Content Management

MikeD
New Member

The Problem

User Defined Content (Dashboards and Looks) are not easily portable across Looker instances, nor can they be backed up and restored to a known state easily. It is not easy to monitor content creation, user activity, etc. In particular, it is not easy to do these activities from scripts that can be run by an operations team.

The Why

Gazer is a command line tool that provides an interface to a Looker instance for the purpose of managing content, users, schedules, etc. It can be used interactively, but also be included in scripts. Finally, it serves as a reference implementation for developers that want to build their own tools.

The How

Gazer currently has 11 commands. The most common commands are user, space, dashboard, look, and plan. Each command has several subcommands tailored for that command. The ls subcommand is very common and will produce a list of objects. The cat subcommand is also common, and will provide the json representation of an object. Typing gzr alone will list all the commands as well as the most common command line switches and options. Typing gzr COMMAND will list the subcommands for that particular command.

The user subcommands are ls, me, cat, enable, disable, and delete. So typing gzr user ls will list all the users on a Looker instance. Typing gzr user disable will disable the given user.

The space subcommands are ls, cat, tree, rm, create, and export. Typing gzr space ls will list the contents of a space. Typing gzr space export will create a set of files that describe the space, all its subspaces, and all the dashboards and looks in those spaces. They can be exported as a set of folders and files on disk suitable for storing in a code repository, or they can be exported into a tar or tgz export file. If they are stored in a code repository, it is easy to track changes over time.

The look and dashboard subcommands are cat, import, and rm. The cat subcommand can be used to save a single dashboard or look to a file. Typing gzr look import will load a look from a file. Typing gzr dashboard import will import a dashboard from a file. The file for the import subcommand can be obtained from the cat subcommand, or from the gzr space export command.

The plan subcommand is used to manage schedules. There are many subcommands, but typing gzr plan failures will list schedules that did not run properly, and gzr plan runit will rerun it.

More information and examples can be found at https://github.com/deangelo-llooker/gzr/wiki

The Setup

Gazer is deployed using the Ruby Gems distribution system. To install, make sure that Ruby 2.3 is installed on your system, then use the command gem install gazer.

This tool is open source. It is not supported by Looker’s normal support channels. It may be possible to purchase support from Looker’s Professional Services team. We are hoping that a community will grow around this tool, however, and support/enhance it further. Issues can be logged at https://github.com/deangelo-llooker/gzr/issues.

*Gazer is developed by Mike DeAngelo aka @MikeD *

13 18 13.2K