Giter Site home page Giter Site logo

gzr's Introduction

Gazer - A Looker Content Utility

Gazer can be used to navigate and manage Spaces, Looks, and Dashboards via a simple command line tool.


Status and Support

As of 2023, Gazer is supported, but not warrantied by Google. Issues and feature requests can be reported via https://github.com/looker-open-source/gzr/issues, which will be regularly monitored and prioritized.

Installation

You can install this gem by simply typing:

$ gem install gazer

Alternately you can follow the Development setup below, typing bundle exec rake install to install it locally

Usage

Display help information...

$ gzr help

Storing Credentials

Store login information by creating the file ~/.netrc in your home directory with the api3 credentials

machine foo.bar.mycompany.com
  login AbCdEfGhIjKlMnOp
  password QrStUvWxYz1234567890

Make sure that the ~/.netrc file has restricted permissions by running chmod 600 ~/.netrc.

API port

Most instances of Looker use port 19999 for the API. Gazer will use that port by default when executing a command. Looker instances that are hosted in Google Cloud direct both the API and the web interface traffic through port 443, the standard https port. Some other installations may also use port 443.

If your Looker instance is GCP-hosted (*.cloud.looker.com), you must specify --port 443, eg:

$ gzr user me --host mycompany.cloud.looker.com --port 443

Options that apply to many commands

--su option

The --su option can be used with a user id to run the command as another user. This options works with all commands. In order to use the --su option the user must provide admin credentials.

For example...

$ gzr user me --su 1237 --host foo.bar.mycompany.com
+----+----------+---------+---------------------+
|  id|first_name|last_name|email                |
+----+----------+---------+---------------------+
|1237|Susan     |Gibson   |[email protected]|
+----+----------+---------+---------------------+

Suppressing Formatted Output

Many commands provide tabular output. For tables the option --plain will suppress the table headers and format lines, making it easier to use tools like grep, awk, etc. to retrieve values from the output of these commands.

CSV Output

Many commands provide tabular output. For tables thehe option --csv will output tabular data in csv format. When combined with --plain the header will also be suppressed.

User Information

The command gzr user help will show details about subcommands of the user command.

user me

Display information about the current user with the command gzr user me.

$ gzr user me --host foo.bar.mycompany.com
+----+----------+---------+--------------------+
|  id|first_name|last_name|email               |
+----+----------+---------+--------------------+
|1234|John      |Smith    |[email protected]|
+----+----------+---------+--------------------+

user ls

Display information about all users with the command gzr user ls.

$ gzr user ls --host foo.bar.mycompany.com
+----+----------+---------+---------------------+
|  id|first_name|last_name|email                |
+----+----------+---------+---------------------+
|1234|John      |Smith    |[email protected] |
|1235|Frank     |Jones    |[email protected] |
|1236|Bill      |Weld     |[email protected]  |
|1237|Susan     |Gibson   |[email protected]|
|1238|Anna      |Grace    |[email protected] |
|1239|Mike      |Arthur   |[email protected]|
+----+----------+---------+---------------------+

Different fields can be returned using the --fields option. For example the option --fields id,first_name,last_name,email,personal_space_id,home_space_id.

Group Information

The command gzr group help will show details about subcommands of the group command.

group ls

The command gzr group ls will list the groups defined on a particular Looker instance.

gzr  group ls  --host foo.bar.mycompany.com
+--+------------------------------------+----------+---------------------+------------------+-----------------+
|id|name                                |user_count|contains_current_user|externally_managed|external_group_id|
+--+------------------------------------+----------+---------------------+------------------+-----------------+
| 4|Ecommerce Dashboard-only User       |         2|false                |                  |                 |
| 5|Marketing                           |         3|false                |                  |                 |
| 6|Developer (no deploy)               |         6|false                |                  |                 |
| 9|dashboard_only                      |         7|false                |                  |                 |
|24|Finance Team                        |         2|false                |                  |                 |
|25|Marketing Team                      |         1|false                |                  |                 |
|36|Embed Shared Group Engineering      |         0|false                |                  |Engineering      |
|37|Embed Shared Group ecomm_only_users |         1|false                |                  |ecomm_only_users |
|38|Embed Shared Group awesome_engineers|         1|false                |                  |awesome_engineers|
|39|sub finance                         |         1|false                |                  |                 |
|49|All Users                           |       570|true                 |true              |                 |
+--+------------------------------------+----------+---------------------+------------------+-----------------+

group member_groups

The command gzr group member_group GROUP_ID will list the groups that have been added as members of the given group id.

$ gzr  group member_group 24  --host foo.bar.mycompany.com
+--+-----------+----------+---------------------+------------------+-----------------+
|id|name       |user_count|contains_current_user|externally_managed|external_group_id|
+--+-----------+----------+---------------------+------------------+-----------------+
|39|sub finance|         1|                     |                  |                 |
+--+-----------+----------+---------------------+------------------+-----------------+

group member_users

The command gzr group member_users GROUP_ID will list the users that have been added as members of the given group id.

$ gzr  group member_users 39  --host foo.bar.mycompany.com
+----+---------------------+---------+----------+-----------------+-------------+
|  id|email                |last_name|first_name|personal_space_id|home_space_id|
+----+---------------------+---------+----------+-----------------+-------------+
|1237|[email protected]|Gibson   |Susan     |              758|          758|
+----+---------------------+---------+----------+-----------------+-------------+

Space Information

The command gzr space help will show details about subcommands of the space command.

space ls

The command gzr space ls will list the contents of a space, including subspaces, looks, and dashboards.

Without any arguments, the command will list the contents of the user's "home" space.

$ gzr space ls --host foo.bar.mycompany.com
+---------+---+------+---------+----------------------------+--------------+--------------------------------+
|parent_id|id |  name|looks(id)|looks(title)                |dashboards(id)|dashboards(title)               |
+---------+---+------+---------+----------------------------+--------------+--------------------------------+
|         |801|Shared|         |                            |              |                                |
|         |801|Shared|857      |Daily Profit                |              |                                |
|         |801|Shared|1479     |totals                      |              |                                |
|         |801|Shared|1486     |Test look2                  |              |                                |
|         |801|Shared|1509     |Aircraft Production by Year |              |                                |
|         |801|Shared|         |                            |192           |Daily Profit Dashboard          |
|         |801|Shared|         |                            |261           |New Test Dashboard              |
|         |801|Shared|         |                            |383           |Sales Dashboard                 |
|         |801|Shared|         |                            |463           |Customer Dashboard              |
+---------+---+------+---------+----------------------------+--------------+--------------------------------+

With the argument "~" the command will list the content of the calling user's "personal" space.

$ gzr space ls "~" --host foo.bar.mycompany.com
+---------+----+----------+---------+-----------------+--------------+-------------------------------------+
|parent_id|id  |      name|looks(id)|looks(title)     |dashboards(id)|dashboards(title)                    |
+---------+----+----------+---------+-----------------+--------------+-------------------------------------+
|      709|1132|John Smith|         |                 |              |                                     |
|      709|1132|John Smith|1570     |test             |              |                                     |
|      709|1132|John Smith|1726     |you can delete me|              |                                     |
|      709|1132|John Smith|1737     |My First Look    |              |                                     |
|      709|1132|John Smith|         |                 |410           |Indicator Dashboard                  |
|      709|1132|John Smith|         |                 |413           |Accidents Dashboard 2011             |
+---------+----+----------+---------+-----------------+--------------+-------------------------------------+

With a simple numeric argument the command will list the content of the space with the given space id.

$ gzr space ls 103 --host foo.bar.mycompany.com

With a tilde plus a simple numeric argument the command will list the content of the personal space of the given user id.

$ gzr space ls "~1237" --host foo.bar.mycompany.com

The user can be identified by name as well.

$ gzr space ls "~Susan Gibson" --host foo.bar.mycompany.com

Finally, the space can be searched by name.

$ gzr space ls "Marketing" --host foo.bar.mycompany.com

space tree

The command gzr space tree will display the child spaces, dashboards, and looks in a tree format.

$ gzr space tree "~" --host foo.bar.mycompany.com
John Smith
├── Trace Data
│   ├── (l) All-Time Visits
│   └── (l) Sessions by Week
├── (l) test
├── (l) you can delete me
├── (l) My First Look
├── (d) Indicator Dashboard
└── (d) Indicator Dashboard 2011

The same arguments are accepted as the space ls command.

space cat

The space cat command is used to output the json that describes the space.

$ gzr space cat 758 --host foo.bar.mycompany.com
{
  "id": 758,
  "creator_id": 1237,
  "name": "Susan Gibson",
  "content_metadata_id": 734,
  "is_personal": true,
  "is_shared_root": false,
  "is_users_root": false,
  "is_personal_descendant": false,
  "is_embed": false,
  "is_embed_shared_root": false,
  "is_embed_users_root": false,
  "external_id": null,
  "parent_id": 709,
  "is_user_root": false,
  "is_root": false,
  "looks": [
  ],
  "dashboards": [
  ],
  "can": {
    "index": true,
    "show": true,
    "create": true,
    "see_admin_spaces": true,
    "update": false,
    "destroy": false,
    "move_content": true,
    "edit_content": true
  }
}

The output document can be very long. Usually one will use the switch --dir DIRECTORY to save to a file. The file will be named Space_{SPACE_ID}_{SPACE_NAME}.json.

space export

The space export SPACE_ID command is used to export a space and its subspaces, looks, and dashboards. The structure of spaces and subspaces will be mirrored in directories and subdirectories in the file system under the directory given by the --dir DIRECTORY switch. The directories will be named like Space_{SPACE_ID}_{SPACE_NAME} and the metadata for each space will be stored in a file with the name Space_{SPACE_ID}_{SPACE_NAME}.json within its corresponding directory.

The JSON information for the Looks and Dashboards in a space are usually part of the space json data. When using the export command, this information would be redundant and so it is not included in the Space_{SPACE_ID}_{SPACE_NAME}.json file.

Looks and Dashboards will be located in the space directories in files named like Look_{LOOK_ID}_{LOOK_TITLE}.json and Dashboard_{DASHBOARD_ID}_{DASHBOARD_TITLE}.json.

$ gzr space export 758 --host foo.bar.mycompany.com --dir .

One interesting consequence of exporting a space into a directory tree is that you can then place its contents under version control using a tool like git. In this way user defined content changes can be tracked over time, and older versions of content can be restored if desired.

Alternately, the space can be exported into a tar style archive file with the switch --tar FILENAME.

$ gzr space export 758 --host foo.bar.mycompany.com --tar export.tar

That tar file can also be automatically compressed with gzip compression by using the switch --tgz FILENAME.

$ gzr space export 758 --host foo.bar.mycompany.com --tgz export.tar.gz

space rm

The space rm SPACE_ID command is used to delete a space. If the space is not empty this command will refuse to perform the delete. By adding the --force switch the command will also delete the subspaces, looks, and dashboards contained in the space.

$ gzr space rm 758 --host foo.bar.mycompany.com --force

space create

The space create NAME PARENT_SPACE_ID command is used to create a new subspace.

$ gzr space create "My New Space" 758 --host foo.bar.mycompany.com

Look Information

The command gzr look help will show details about subcommands of the look command.

look cat

The look cat command is used to output the json that describes the look.

$ gzr look cat 758 --host foo.bar.mycompany.com
JSON data for look

The output document can be very long. Usually one will use the switch --dir DIRECTORY to save to a file. The file will be named Look_{LOOK_ID}_{LOOK_TITLE}.json.

look rm

The look rm LOOK_ID command is used to delete a look.

$ gzr look rm 758 --host foo.bar.mycompany.com

look import

The look import LOOK_FILE SPACE_ID command is used to import a look from a file. If a look by the same name exists in that space then the --force switch must be used.

Gazer will attempt to update an existing look of the same name, rather than create a new look. In this way the look id, share URLs, schedules, permissions, etc. will be preserved.

$ gzr look import Path/To/Look_123_My\ Look.json 123 --host foo.bar.mycompany.com --force

Dashboard Information

The command gzr dashboard help will show details about subcommands of the dashboard command.

dashboard cat

The dashboard cat command is used to output the json that describes the dashboard.

$ gzr dashboard cat 192 --host foo.bar.mycompany.com
JSON data for dashboard

The output document can be very long. Usually one will use the switch --dir DIRECTORY to save to a file. The file will be named Dashboard_{DASHBOARD_ID}_{DASHBOARD_TITLE}.json.

The --transform FILE switch can be used to update the output document. This is useful to automatically perform tasks when promoting dashboards to upper environments, such as adding header or footer text tiles, replacing model or explore names, or updating filter expressions. The FILE parameter accepts a fully-qualified path to a JSON file describing the transformations to apply.

$ gzr dashboard cat 192 --host foo.bar.mycompany.com --transform path/to/transforms.json
JSON data for dashboard modified by any transformations expressed in the transform file

The transform file uses a familiar JSON syntax. Within the file, you can define any number of dashboard_elements to append to your existing dashboard. Elements must be placed in either the top row or the bottom row of the existing dashboard, specified by the position attribute. You must also specify the width and height of your new elements.

You can also define any number of replacements, which perform a simple find and replace within the JSON output based on the key-value pairs listed. This can be used to automatically replace model names or update filters for existing elements. You must escape double-quotes.

Example JSON transform file:

{
  "dashboard_elements": [
    {
      "position": "top",
      "width": 12,
      "height": 2,
      "body_text": "Production Version of Dashboard (deployed 2019-06-18)",
      "body_text_as_html": "<p>Production Version of Dashboard (deployed 2019-06-18)</p>",
      "note_display": null,
      "note_state": null,
      "note_text": null,
      "note_text_as_html": null,
      "subtitle_text": "",
      "title": null,
      "title_hidden": false,
      "title_text": "",
      "type": "text"
    },
    {
      "position": "bottom",
      "width": 6,
      "height": 2,
      "body_text": "Please contact the Business Intelligence Help Desk for any issues with this dashboard",
      "body_text_as_html": "<p>Please contact the Business Intelligence Help Desk for any issues with this dashboard</p>",
      "note_display": null,
      "note_state": null,
      "note_text": null,
      "note_text_as_html": null,
      "subtitle_text": "",
      "title": null,
      "title_hidden": false,
      "title_text": "",
      "type": "text"
    }
  ],
  "replacements": [
    {
      "\"model\": \"staging\",": "\"model\": \"production\","
    },
    {
      "\"filter_expression\": \"not(is_null(${view.allowed_user}))\": "\"filter_expression\": \"${view.allowed_user} = _user_attributes['username']\","
    }
  ]
}
WARNING: You will not be able to overwrite dashboards that have been transformed!

In other words, you can’t use the --force switch to replace a previously-transformed dashboard. Instead, you’ll need to delete and recreate the dashboard. If you have stable content URLs enabled on your instance, the slug parameter ensures the URL for your dashboard won’t change.

This is because it is impossible to know the element IDs for elements that were added by the --transform operation, which makes it impossible to synchronize these elements in the future.

dashboard rm

The dashboard rm DASHBOARD_ID command is used to delete a dashboard.

$ gzr dashboard rm 192 --host foo.bar.mycompany.com

dashboard import

The dashboard import DASHBOARD_FILE SPACE_ID command is used to import a dashboard and its associated looks from a file. If a dashboard or look by the same name exists in that space then the --force switch must be used.

Gazer will attempt to update an existing dashboard or look of the same name, rather than create a new dashboard or look. In this way the id, share URLs, schedules, permissions, etc. will be preserved.

$ gzr dashboard import Path/To/Dashboard_123_My\ Dash.json 123 --host foo.bar.mycompany.com --force

Connection Information

The command gzr connection help will show details about subcommands of the connection command.

connection ls

The command gzr connection ls will list the connections that exist in the Looker instance.

$ gzr connection ls --host foo.bar.mycompany.com
+-------------------------+---------------------+-----------------+----+--------------------------+-----------+
|name                     |dialect.name         |host             |port|database                  |schema     |
+-------------------------+---------------------+-----------------+----+--------------------------+-----------+
|thelook                  |mysql                |db1.mycompany.com|3306|demo_db                   |           |
|faa                      |mysql                |db1.mycompany.com|3306|flightstats               |           |
|video_store              |mysql                |db1.mycompany.com|3306|sakila                    |           |
|looker                   |mysql                |                 |    |                          |           |
+-------------------------+---------------------+-----------------+----+--------------------------+-----------+

connection dialect

The command gzr connection dialect will list the dialects that have been defined in the Looker instance.

$ gzr connection dialect --host foo.bar.mycompany.com
+---------------------+----------------------------------+
|name                 |label                             |
+---------------------+----------------------------------+
|mysql                |MySQL                             |
|amazonaurora         |Amazon Aurora                     |
|googlecloudsql       |Google Cloud SQL                  |
|memsql               |MemSQL                            |
|mariadb              |MariaDB                           |
|clustrix             |Clustrix                          |
|postgres             |PostgreSQL                        |
|google_cloud_postgres|Google Cloud PostgreSQL           |
|azure_postgres       |Azure PostgreSQL                  |
|presto               |PrestoDB                          |
|athena               |Amazon Athena                     |
|qubole_presto        |Qubole Presto v0.157+             |
|qubole_presto_v142   |Qubole Presto v0.142              |
|xtremedata           |XtremeData                        |
|redshift             |Amazon Redshift                   |
|snowflake            |Snowflake                         |
|greenplum            |Greenplum                         |
|mssql_2008           |Microsoft SQL Server 2008+        |
|msazuresql           |Microsoft Azure SQL Database      |
|mssql                |Microsoft SQL Server 2005         |
|mssqldw              |Microsoft Azure SQL Data Warehouse|
|aster                |Aster Data                        |
|vertica              |Vertica 7.1+                      |
|vertica_v5           |Vertica 6                         |
|bigquery             |Google BigQuery Legacy SQL        |
|bigquery_standard_sql|Google BigQuery Standard SQL      |
|spanner              |Google Cloud Spanner              |
|db2                  |IBM DB2                           |
|datavirtuality       |DataVirtuality                    |
|dashdb               |IBM DashDB                        |
|hana                 |SAP HANA                          |
|oracle               |Oracle                            |
|oracle_dwcs          |Oracle ADWC                       |
|hive2                |Apache Hive2                      |
|impala               |Cloudera Impala                   |
|spark1_5             |Apache Spark 1.5+                 |
|spark2_0             |Apache Spark 2.0                  |
|teradata             |Teradata                          |
|exasol               |Exasol                            |
|denodo               |Denodo                            |
|druid                |Druid                             |
|netezza              |IBM Netezza                       |
|dremio               |Dremio                            |
+---------------------+----------------------------------+

Model Information

The command gzr model help will show details about subcommands of the model command.

model ls

The command gzr model ls will list the models that exist in the Looker instance.

$ gzr model ls --host foo.bar.mycompany.com
+---------------------------------------------+---------------------------------------------+-------------------------+
|name                                         |label                                        |project_name             |
+---------------------------------------------+---------------------------------------------+-------------------------+
|faa                                          |Faa                                          |faa                      |
|300_daily_active_users                       |300 Daily Active Users                       |lookml_design_patterns   |
|001_hello_world                              |001 Hello World                              |lookml_design_patterns   |
|video_store                                  |Video Store                                  |video_store              |
|looker                                       |Looker                                       |i__looker_dev            |
|faa_redshift                                 |Faa Redshift                                 |faa_redshift             |
+---------------------------------------------+---------------------------------------------+-------------------------+

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/looker-open-source/gzr. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Code of Conduct

Everyone interacting in the Gazer project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

Copyright

Copyright (c) 2018 Mike DeAngelo for Looker Data Sciences. See MIT License for further details.

gzr's People

Contributors

adamminton avatar cpiwarski avatar ddaugherty avatar drewgillson avatar drstrangelooker avatar dsoegijono avatar ebear avatar github-actions[bot] avatar jannarobertson-bytecode avatar jcarah avatar jessehub avatar looker-open-source-automation-bot avatar martinguindon avatar maui21 avatar michaelcramer avatar teka23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gzr's Issues

Required Permissions

I apologize ahead of time if this is a dumb question. It has been a long time since I have done any admin work on a Linux system....

Our Looker Developers are saying they need access to the CLI to be able to run Gazer commands. My question is what sort of permissions do they need in order to be able to do that? Do they need RW permissions to the Gazer files, or RO and EX only? What about access to the Looker files? Do they need any permissions to those? I haven’t actually installed Gazer yet, so I’m not sure how it interacts with Looker.... If it interacts with Looker via the API or something like that, then I’m guessing the developers do not need access to the Looker files, but that still leaves me with the question of whether they need RO, RW, and/or EX permissions to any/all of the Gazer files.

Again, sorry if this is a dumb question. I am just trying to find out as much as I can prior to installing Gazer and granting the necessary CLI access to the developers.

Also, the readme says to use gem to install Gazer. We are running Looker on Ubuntu 18.04, and don’t have Ruby Rails installed. I assume I need to do that first. Is the full Ruby package required (apt-get ruby-full)? Also, I assume Gazer needs to be installed onto the same server as Looker.... If that is not the case, or not recommended, please let me know. The instructions are a bit lacking in regards to requirements, configuration, etc.....

Thanks,

-Evan

error while importing dashbords: resource already exists

deleted the existing dashboard and tried to re-import dashboard from another instance. Its throwing an error resource already exists, even with --force parameter on the import

The resource already exists.

/var/lib/gems/2.3.0/gems/looker-sdk-0.0.6/lib/looker-sdk/response/raise_error.rb:15:in on_complete' /var/lib/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/response.rb:9:in block in call'
/var/lib/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/response.rb:57:in on_complete' /var/lib/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/response.rb:8:in call'
/var/lib/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/rack_builder.rb:139:in build_response' /var/lib/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/connection.rb:377:in run_request'
/var/lib/gems/2.3.0/gems/faraday-0.9.2/lib/faraday/connection.rb:177:in post' /var/lib/gems/2.3.0/gems/sawyer-0.8.1/lib/sawyer/agent.rb:94:in call'
/var/lib/gems/2.3.0/gems/looker-sdk-0.0.6/lib/looker-sdk/client.rb:280:in request' /var/lib/gems/2.3.0/gems/looker-sdk-0.0.6/lib/looker-sdk/client.rb:84:in post'
/var/lib/gems/2.3.0/gems/looker-sdk-0.0.6/lib/looker-sdk/client/dynamic.rb:97:in invoke_remote' /var/lib/gems/2.3.0/gems/looker-sdk-0.0.6/lib/looker-sdk/client/dynamic.rb:63:in method_missing'
/var/lib/gems/2.3.0/gems/gazer-0.2.6/lib/gzr/modules/dashboard.rb:59:in create_dashboard' /var/lib/gems/2.3.0/gems/gazer-0.2.6/lib/gzr/commands/dashboard/import.rb:92:in sync_dashboard'
/var/lib/gems/2.3.0/gems/gazer-0.2.6/lib/gzr/commands/dashboard/import.rb:35:in block (2 levels) in execute' /var/lib/gems/2.3.0/gems/gazer-0.2.6/lib/gzr/modules/filehelper.rb:57:in read_file'
/var/lib/gems/2.3.0/gems/gazer-0.2.6/lib/gzr/commands/dashboard/import.rb:33:in block in execute' /var/lib/gems/2.3.0/gems/gazer-0.2.6/lib/gzr/modules/session.rb:163:in with_session'
/var/lib/gems/2.3.0/gems/gazer-0.2.6/lib/gzr/commands/dashboard/import.rb:29:in execute' /var/lib/gems/2.3.0/gems/gazer-0.2.6/lib/gzr/commands/dashboard.rb:37:in import'
/var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in run' /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in invoke_command'
/var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in dispatch' /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:115:in invoke'
/var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:238:in block in subcommand' /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in run'
/var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in invoke_command' /var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in dispatch'
/var/lib/gems/2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in start' /var/lib/gems/2.3.0/gems/gazer-0.2.6/exe/gzr:14:in <top (required)>'
/usr/local/bin/gzr:22:in load' /usr/local/bin/gzr:22:in

'

"Error: Not found" when importing dashbaord

C:\Users\aolson>gzr dashboard import "C:\Users\aolson\Engineering & Facilities\Dashboard_48_Engineering & Facilities Detail.json" 193 --host=lonza.eu.looker.com --force
Error creating dashboard({
"description": null,
"hidden": false,
"query_timezone": null,
"refresh_interval": null,
"title": "Engineering & Facilities Detail",
"background_color": null,
"load_configuration": "cache_run",
"lookml_link_id": null,
"show_filters_bar": null,
"show_title": null,
"text_tile_text_color": null,
"tile_background_color": null,
"tile_text_color": null,
"title_color": null,
"folder_id": 38,
"deleted": false,
"slug": "uo5bLXwHSFUbskkFeAidva",
"space_id": "193",
"user_id": 15
})
Not found

ERROR: Not found

Space Export fails on too long name

Hi,
When I run space export command I get this error if space contains look with a very long name: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/package/tar_writer.rb:336:in 'split_name': File "Shared/really long file name.json" has a too long name (should be 100 or less)

Users migration

It's not an issue but rather functionality request
If it possible to export all the Looker users from one instance and import them back to another one.
It could be potentially user_id clash between the instances, but it's fine for me to fix it manually.

Issue when modifying dashboard including text tile

Gazer version = v0.2.14
Looker version = 6.16.10

We have a customer set up on 2 instances, dev and prod. We are modifying content in dev instance, then promoting content to prod when changes have been made using gzr. We need to keep the dashboard slugs from dev to prod the same so links do not break..
The majority of dashboards move over fine, however if a dashboard contains a text tile we get this error message:

Modifying existing dashboard 2 E-commerce | Direct control tower in space 9
Error updating dashboard_element(27,{
  "body_text": "<p><a href=\"https://analytics.google.com/analytics/web/#/report/visitors-geo/a7823531w161529192p162626565/geo-segmentExplorer.segmentId=analytics.city&geo-table.plotKeys=%5B%5D/\" target=\"_blank\"><img src=\"https://s3-us-west-2.amazonaws.com/s.cdpn.io/1615306/Google%20Analytics%20logo_lockup_analytics_icon_vertical_black_2x.png\" alt=\"\" height=\"85\" /></a></p>",
  "dashboard_id": 2,
  "look_id": null,
  "merge_result_id": null,
  "note_display": null,
  "note_state": null,
  "note_text": null,
  "query_id": null,
  "refresh_interval": null,
  "result_maker": null,
  "subtitle_text": "",
  "title": "GA Icon",
  "title_hidden": false,
  "title_text": "",
  "type": "text"
})
Validation Failed
{:field=>"type", :code=>"invalid", :message=>"Result Maker IDs should not be provided for text elements", :documentation_url=>"http://docs.looker.com/"}```

So far I have to remove the text tile in dev content and then add it in manually in prod.

Thank you!

Gazer 0.2.14 - dashboard exported then imported across environments ends up in space with wrong id

Hello,

We are hosting Looker 6.22.16 with on-prem clustered setups for each region. If I export a space from region A's environment with Gazer (lets say it has space id 123), then import it to space 456 in region B's environment with
gzr dashboard import "MyDashboard.json" 456 --host example.com --port 443 --debug --force --no-verify-ssl,
this actually results in the dashboard being uploaded to space 123 in region B, not space 456. Note that space 123 already existed in region B's environment.

I suspect MyDashboard.json having a reference to space 123 is part of the issue.

I'm not sure if this is still an issue, because I haven't been able to test on 0.2.19 due to this issue.

Thanks a lot.

merge_result_id based tile not being by create_dashboard_element method

Trying to import a dashboard:

gzr dashboard import byoms/Dashboard_3593_BYOMS.json 3346 --host <myhost>.com --force

Results in this error message:

Error creating dashboard_element({
  "type": "vis",
  "refresh_interval": null,
  "note_text": null,
  "note_display": null,
  "note_state": null,
  "title_hidden": false,
  "title_text": null,
  "title": "PDT Build Times",
  "subtitle_text": null,
  "body_text": null,
  "query_id": null,
  "look_id": null,
  "dashboard_id": 3889
})
Validation Failed
{:field=>"type", :code=>"invalid", :message=>"Must provide either a look_id, query_id, or merge_result_id for non-text dashboard element"}

However, the element with the issues "PDT Build Times" does have a merge_result_id contrary to the error message:

  {
      "id": 18461,
      "dashboard_id": 3593,
      "look_id": null,
      "type": "vis",
      "refresh_interval": null,
      "refresh_interval_to_i": null,
      "note_text": null,
      "note_text_as_html": null,
      "note_display": null,
      "note_state": null,
      "title_hidden": false,
      "title_text": null,
      "title": "PDT Build Times",
      "subtitle_text": null,
      "body_text": null,
      "body_text_as_html": null,
      "look": null,
      "query": null,
      "query_id": null,
      "edit_uri": null,
      "merge_result_id": "m4bJ6AZns8DOEAEmTBFRcL",

Full dashboard_json:
Dashboard_3593_BYOMS.json.txt

Not able to update an existing dashboard in destination instance

Ruby version: ruby 2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux]
Gazer version: v0.2.12
Looker version: 6.10

Gazer is not able to update a previously imported dashboard. It works fine in Looker 6.6, but does not work in 6.10.

$ gzr dashboard cat 2309 --host="source_host" --no-verify-ssl --dir adhoc_space/
$ gzr dashboard import adhoc_space/Dashboard_2309_dash1.10.json 2431 --host="d-looker.sys.cigna.com" --no-verify-ssl --force
Imported dashboard 3133
$ ll adhoc_space/
total 8
-rw-r--r--. 1 looker domain users 7464 May 28 11:31 Dashboard_2309_dash1.10.json
$ gzr dashboard import adhoc_space/Dashboard_2309_dash1.10.json 2431 --host="destination_host" --no-verify-ssl --force
Modifying existing dashboard 3133 dash1.10 in space 2431
Error updating dashboard_element(19563,{
  "body_text": null,
  "dashboard_id": null,
  "look_id": null,
  "merge_result_id": null,
  "note_display": null,
  "note_state": null,
  "note_text": null,
  "query_id": 778897,
  "refresh_interval": null,
  "result_maker": {
    "filterables": [
      {
        "model": "looker_db",
        "view": "history",
        "name": null,
        "listen": [

        ]
      }
    ]
  },
  "subtitle_text": null,
  "title": "Untitled",
  "title_hidden": false,
  "title_text": null,
  "type": "vis"
})
Not found

ERROR: Not found

Thank you

Dashboard Import fails on filter deletion

When using dashboard import across two Looker instances, the dashboard import will fail when one of the source filters is deleted.

Repro:

  1. In one Looker instance, create a dashboard with 2 filters
  2. Use dashboard import to move the dashboard into the second instance
  3. In original Looker instance, delete a dashboard filter
  4. Attempt to dashboard import.

Result:
Import fails with Resource already exists error

Dashboard Import Fails When Text Elements are Deleted And Replaced

When using dashboard import across two Looker instances, the dashboard import will fail when a text element is destroyed and recreated.

Repro:

  1. In first Looker instance (A) on a fresh dashboard, create a text element
  2. In the same dashboard, create a tile from an explore.
  3. Use Gazer to export/import the dashboard into Looker instance (B)
  4. In A, on the same dashboard that was deployed, delete the text element.
  5. In the same dashboard, recreate the text element with the exact same copy as the deleted element.
  6. Attempt to use Gazer to export/import the dashboard into B

Expected:
The import is successful

Result:
Import fails with a message similar to Cannot update text element with result_maker_id

Schedule run once: Not found

Expected behavior

When executing a command to run schedule once, gazer should run the schedule and deliver content to specified destination

Actual behavior

Getting error: Not found
JSON file of the schedule is provided in the stdout.
When I grab the JSON and run it in Looker API, i get the same error. I discovered that if i remove 'id' from the JSON, the schedule runs fine in Looker API

Steps to reproduce the behavior

gzr plan runit 843 --host=looker.company.com --no-verify-ssl

Please let me know if i can provide any additional information.

Thank you

Feature Request: Space Import

I'd like to import an entire space all at once. Basically, a list of json files (looks and dashboards) into one destination space.

Distinguish "Invalid Credentials" error message from "SSL problem"

I was trying to authenticate into gazer and kept getting an "Invalid Credentials" error message even though they were correct. The problem turned out to be solved when I used the option to not check for proper SSL (temporary workaround, actually fixing the problem now). If there was a different message I could have saved some time. Thanks!

running into syntax errors, when running a list of commands

Hello,

Recently I installed gazer on a debian8 VM. In general it is working fine. However there is a bunch of commands which produce syntax errors. I am curious, where this comes from and if it's specific problem with our setup or if something changed with looker version 5.24potentially. Maybe someone can replicate this.

I get the syntax error for these commands, it is always about an unexpected '.'

gzr plan ls
gzr user ls
gzr connection ls

This is what the error looks like:

gzr plan ls --host=my.looker.tls
/var/lib/gems/2.1.0/gems/gazer-0.2.6/lib/gzr/commands/plan/ls.rb:61:in `eval': (eval):1: syntax error, unexpected '.' (SyntaxError)
row.user&.id
          ^
        from /var/lib/gems/2.1.0/gems/gazer-0.2.6/lib/gzr/commands/plan/ls.rb:61:in `block (3 levels) in execute'
        from /var/lib/gems/2.1.0/gems/gazer-0.2.6/lib/gzr/commands/plan/ls.rb:60:in `collect'
        from /var/lib/gems/2.1.0/gems/gazer-0.2.6/lib/gzr/commands/plan/ls.rb:60:in `block (2 levels) in execute'
        from /var/lib/gems/2.1.0/gems/gazer-0.2.6/lib/gzr/commands/plan/ls.rb:59:in `map'
        from /var/lib/gems/2.1.0/gems/gazer-0.2.6/lib/gzr/commands/plan/ls.rb:59:in `block in execute'
        from /var/lib/gems/2.1.0/gems/gazer-0.2.6/lib/gzr/modules/session.rb:163:in `with_session'
        from /var/lib/gems/2.1.0/gems/gazer-0.2.6/lib/gzr/commands/plan/ls.rb:19:in `execute'
        from /var/lib/gems/2.1.0/gems/gazer-0.2.6/lib/gzr/commands/plan.rb:123:in `ls'
        from /var/lib/gems/2.1.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
        from /var/lib/gems/2.1.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
        from /var/lib/gems/2.1.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
        from /var/lib/gems/2.1.0/gems/thor-0.20.0/lib/thor/invocation.rb:115:in `invoke'
        from /var/lib/gems/2.1.0/gems/thor-0.20.0/lib/thor.rb:238:in `block in subcommand'
        from /var/lib/gems/2.1.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
        from /var/lib/gems/2.1.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
        from /var/lib/gems/2.1.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
        from /var/lib/gems/2.1.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
        from /var/lib/gems/2.1.0/gems/gazer-0.2.6/exe/gzr:14:in `<top (required)>'
        from /usr/local/bin/gzr:23:in `load'
        from /usr/local/bin/gzr:23:in `<main>

All the other commands I've been testing, have been working fine.
Could somebody potentially give me any insight on why this is happening?
Thanks!

Support for space export for files with a containing “/” in content's name

Currently the space export function breaks for content that have a "/" in the name. Running gzr space export N --debug --dir . returns the following error message:

/Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/modules/filehelper.rb:34:in `initialize': No such file or directory @ rb_sysopen - /Users/David/.../Look_N_abc/xyz.json (Errno::ENOENT)
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/modules/filehelper.rb:34:in `open'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/modules/filehelper.rb:34:in `write_file'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space/export.rb:67:in `block in process_space'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space/export.rb:65:in `each'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space/export.rb:65:in `process_space'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space/export.rb:79:in `block in process_space'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space/export.rb:78:in `each'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space/export.rb:78:in `process_space'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space/export.rb:79:in `block in process_space'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space/export.rb:78:in `each'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space/export.rb:78:in `process_space'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space/export.rb:50:in `block in execute'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/modules/session.rb:138:in `with_session'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space/export.rb:27:in `execute'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/lib/gzr/commands/space.rb:55:in `export'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:115:in `invoke'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor.rb:238:in `block in subcommand'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/thor-0.20.0/lib/thor/base.rb:466:in `start'
    from /Users/David/.rvm/gems/ruby-2.3.0/gems/gazer-0.1.8/exe/gzr:14:in `top (required)'
    from /Users/David/.rvm/gems/ruby-2.3.0/bin/gzr:23:in `load'
    from /Users/David/.rvm/gems/ruby-2.3.0/bin/gzr:23:in `main'
    from /Users/David/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/David/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `main'

Gazer 0.2.19 - Dashboard import fails with 2 arguments

Hi,

Firstly, love the tool, so thanks for that!

Anyway, with Gazer 0.2.19, gzr dashboard help states this for import:
gzr dashboard import FILE DEST_SPACE_ID # Import a dashboard from a file

However, running this:
gzr dashboard import "MyDashboard.json" 58 --host example.com --port 443 --debug --force --no-verify-ssl

Is throwing:

C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gazer-0.2.19/lib/gzr/modules/session.rb:40:in `say_warning': wrong number of arguments (given 2, expected 1) (ArgumentError)
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gazer-0.2.19/lib/gzr/commands/dashboard/import.rb:49:in `execute'
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gazer-0.2.19/lib/gzr/commands/dashboard.rb:60:in `import'
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:115:in `invoke'
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:238:in `block in subcommand'
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
        from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/gazer-0.2.19/exe/gzr:36:in `<top (required)>'
        from C:/Ruby26-x64/bin/gzr:23:in `load'
        from C:/Ruby26-x64/bin/gzr:23:in `<main>'

Thanks again

Cannot move dashboard to a new space

Here is the use case
I initially imported dashboard x from instance A to instance B under space y
Now I need to import the same dashboard again from A to B and at the same time move it to a new space z (or move it from space y to z then import again)
The only option is to do another import to space z but that gives me:
slug <slug id> already used for dashboard <dashboard x's title> in space y dashboard will be imported with new slug
so now I have two copies of the dashboard, I'd like it to have the same id after being moved to the new space so users can still reference it with the same url. Exactly the same way you'd move dashboards between spaces from the UI.
Did I miss a way to do that with gazer or do we perhaps need a gzr mv command that would move a dashboard between two spaces on the same instance?

need to get ID of content with a given "title"

We are using gzr to update existing content by exporting json of a dev version, and then importing over an existing piece of content using --force, it will "overwrite" based on the title of the content.
In order to make some checks and archive things before we force overwrite we need to get the content ID of the content given the title only. We know if we are working with a Look or a Dashboard before hand. 2 options here:

  1. space ls and then search out the ID of either l or db based on the title. Problem here is that a space can contain a look and a db containing the same title, lots of string manipulation here to make sure we get the right record - Ideally we could use the --fields flag here but this is not available with space command
  2. space tree and then search out the ID using the name and filtering on (l) or (d). The ID is not present in the space view, a simple addition which I am happy to go ahead with myself, just want someone else's opinion.

Thx

Gazer 2.3.0 is returning SSL errors with --no-verify-ssl option

gzr returns below error message in 0.2.3 when --no-verify-ssl is specified. Removing gazer-0.2.30 and switching back to gazer-0.2.28 resolved the issue.

ERROR: SSL Certificate could not be verified
Do you need the --no-verify-ssl option or the --no-ssl option?

Dashboard Import Fails on Existing Dashboard

Tested that the error did not exist with older version of Looker (last test was 6.0.27). Current version 6.10.14 gives this error when updating an existing dashboard:

Modifying existing dashboard 6 Demo Dashboard from son in space 9
Error updating dashboard_element(27,{
"body_text": null,
"dashboard_id": null,
"look_id": null,
"merge_result_id": null,
"note_display": null,
"note_state": null,
"note_text": null,
"query_id": 102,
"refresh_interval": null,
"result_maker": {
"filterables": [
{
"model": "dev_thecompany",
"view": "orders",
"name": null,
"listen": [
{
"dashboard_filter_name": "Order Status",
"field": "orders.status"
}
]
}
]
},
"subtitle_text": null,
"title": "Order Count",
"title_hidden": false,
"title_text": null,
"type": "vis"
})
Not found

ERROR: Not found

Looker import fails: Error creating query -- Not Found

Gazer v0.2.13, Looker Version 6.4 .. Initial look creation.
Used to work with v0.2.12 and Looker 6.2 with no issues .. This also means that moving dashboards with looks moves the dashboard without its looks

gzr look cat <look_id> --host=<host1> > <look_id>.json
gzr look import <look_id>.json <space_id> --host=<host2>
Error creating query({
  "view": "..",
  "fields": [
    ..
  ],
..
})
Not found

I'm guessing a change similar to this is needed for looks?

Disable inactive users automatically via API

As far as I can see, we are very close to being able to do this via i_looker + update_user API, but the problem is the i_looker explore on event gives you all logins per user, not just the max or last one. I've filed a request for custom fields to allow Max() on Date fields to get around this. But this would be a great addition to gzr.

2nd attempt to overwrite dashboard with text element fails with "Result Maker IDs should not be provided for text elements"

When attempting to overwrite a dashboard with a text element for the 2nd time, import fails with the following error:

Error updating dashboard_element(6,{
  "body_text": null,
  "dashboard_id": 8,
  "look_id": null,
  "merge_result_id": null,
  "note_display": null,
  "note_state": null,
  "note_text": null,
  "query_id": null,
  "refresh_interval": null,
  "result_maker": null,
  "subtitle_text": null,
  "title": null,
  "title_hidden": false,
  "title_text": "State Data",
  "type": "text"
})
Validation Failed
{:field=>"type", :code=>"invalid", :message=>"Result Maker IDs should not be provided for text elements", :documentation_url=>"http://docs.looker.com/"}

Dashboard Import fails: "Must provide either a look_id, query_id, or result_maker_id for non-text dashboard element"

gazer=v.0.2.13
ruby=v2.3.1p112

  1. I am setting up a looker instance script that is supposed to create a new ec2 instance if existing looker instance fails.

  2. The internal database was migrated to MySQL on RDS.

  3. We only have dashboards made on LookML Dashboards.

  4. In the existing instance, I run:
    gzr space export lookml --host <source_host> --no-verify-ssl --dir <directory>
    and space/dashboards are exported successfully (it looks like).

  5. In the new instance, I run:
    gzr dashboard import "<dashboard_name>" <space_id> --host <dest_host> --no-verify-ssl

But validation fails. Possibly trying to find look_id, query_id, or result_maker_id:

Error creating dashboard_element({
  "type": "vis",
  "refresh_interval": null,
  "note_text": "This is the top-level number, representing how close we are to 100% sustainable services - given however we define sustainable in terms of various metrics.",
  "note_display": "below",
  "note_state": "expanded",
  "title_hidden": false,
  "title_text": null,
  "title": "Service Sustainability",
  "subtitle_text": null,
  "body_text": null,
  "query_id": null,
  "look_id": null,
  "merge_result_id": null,
  "dashboard_id": 2,
  "result_maker": {
    "filterables": [
      {
        "model": "engineering",
        "view": "services",
        "name": null,
        "listen": [

        ]
      }
    ]
  }
})
Validation Failed
{:field=>"type", :code=>"invalid", :message=>"Must provide either a look_id, query_id, or result_maker_id for non-text dashboard element"}

Dashboard imports to random space

I have been gazering dashboards from a test instance to a prod instance. When I imported a dashboard to update an existing one, it looked like the dashboard was deleted. Then when I ran the command again without --force, it became apparent that it was imported into the space I didn't specify. It imported it into space 25, whereas I stated 389.

In between 2 and 3 (below) is where it looked like the content was deleted.

dysonuk.eu.looker.com (6.22.11) and dysonprod.eu.looker.com (6.22.11)
gzr (v0.2.14)

` 1 $ gzr dashboard cat sjmMNV6XVODeUh1c2bsk6v --host=dysontest.eu.looker.com > global_overview.json

2 $ gzr dashboard import global_overview.json 389 --host=dysonuk.eu.looker.com --force

3 $ gzr dashboard import global_overview.json 389 --host=dysonuk.eu.looker.com
slug sjmMNV6XVODeUh1c2bsk6v already used for dashboard Global overview | Direct control tower in space 25
dashboard will be imported with new slug
Error creating dashboard({
"description": null,
"hidden": false,
"query_timezone": "UTC",
"refresh_interval": null,
"title": "Global overview | Direct control tower",
"background_color": null,
"load_configuration": "cache_run",
"lookml_link_id": "digital_direct::global_overview__direct_control_tower",
"show_filters_bar": null,
"show_title": null,
"text_tile_text_color": null,
"tile_background_color": null,
"tile_text_color": null,
"title_color": null,
"folder_id": 25,
"deleted": false,
"space_id": "389",
"user_id": 106
})
Validation Failed
{:field=>"[:title, :space_id]", :code=>"already_exists", :message=>"Dashboard with this title already exists.", :documentation_url=>"http://docs.looker.com/"}
ERROR: Validation Failed`

Metadata info, like updated_at times, for content

Had a customer interested in seeing metadata information while using gazr. Specifically, they wanted to see when dashboards were last updated. Suggested using the API to view updated_at details.

Gazer export on nil space fails

I am trying to run gzr space export 2 --dir . but get the failure below.

When I run gzr space tree 2, it shows:
Users
└── nil (340)
└── Person Name
...

Error Log:
/Library/Ruby/Gems/2.3.0/gems/gazer-0.2.13/lib/gzr/commands/space/export.rb:78:in `process_space': undefined method `gsub' for nil:NilClass (NoMethodError) from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.13/lib/gzr/commands/space/export.rb:111:in `block in process_space' from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.13/lib/gzr/commands/space/export.rb:110:in `each' from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.13/lib/gzr/commands/space/export.rb:110:in `process_space' from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.13/lib/gzr/commands/space/export.rb:71:in `block in execute' from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.13/lib/gzr/modules/session.rb:193:in `with_session' from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.13/lib/gzr/commands/space/export.rb:48:in `execute' from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.13/lib/gzr/commands/space.rb:76:in `export' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/invocation.rb:115:in `invoke' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor.rb:238:in `block in subcommand' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/base.rb:466:in `start' from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.13/exe/gzr:36:in `<top (required)>' from /usr/local/bin/gzr:22:in `load' from /usr/local/bin/gzr:22:in `<main>'

Space tree does not escape forward slash "/" character

Space titles that contain a forward slash "/" do not properly show up using space tree command.
Example: Space name "Test / Migration" would output just "Migration" ignoring whatever came before the slash.
Back slash works fine.

Thank you

Single Dashboard Export

Instead of exporting the entire space by looping through the entire list of dashboards, it'd be great if we could grep or provide an ID of the dashboard in that space as a sub command to just specify one object.

The problem this would solve is that in a dev->staging-> prod workflow, often QAs can be making changes in the same space as the target dashboard, and developers can unknowingly export those changes and fully overwrite the target space. The obvious answer to this is to only import that dashboard, but being able to explicitly set the exported dashboard would clean up the process and have it be tighter.

Unable to install gazer on mac

➜ ~ gem install gazer
ERROR: Could not find a valid gem 'looker-sdk-fork' (~> 0.0.6) in any repository
ERROR: Possible alternatives: looker-sdk

➜ ~ ruby --version
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]

Error importing dashboards and looks to empty space

I am trying to import my dashboards & looks to an empty space. I deleted the contents from the space and the trash, so there shouldn't be no objects that already exist. I get the error below. I have updated Gazer to the latest and no change.

Error updating dashboard_element(3265,{
"body_text": null,
"dashboard_id": null,
"look_id": 1414,
"merge_result_id": null,
"note_display": null,
"note_state": null,
"note_text": null,
"query_id": null,
"refresh_interval": null,
"result_maker": {
"filterables": [
{
"model": "partner_engagement",
"view": "tblassetclicklog",
"name": null,
"listen": [
{
"dashboard_filter_name": "Account Name",
"field": "account.name_raw"
},
{
"dashboard_filter_name": "School Name",
"field": "site.name"
},
{
"dashboard_filter_name": "School GUID",
"field": "site.site_guid"
},
{
"dashboard_filter_name": "Date",
"field": "tblassetclicklog.click_date"
}
]
}
]
},
"subtitle_text": null,
"title": null,
"title_hidden": false,
"title_text": null,
"type": "vis"
})
Not found

Issues Connecting to Instance

I'm having troubles connecting to my Looker instances with gzr. I was successfully able to connect to our trial Looker instance, but our companies instances I keep getting the following error:
ERROR: Connection Failed. Did you specify the --no-ssl option for an ssl secured server?
I include --no-ssl when I try to connect and get the same error. Any suggestions on what the connection problem could be and how to fix it?

Dashboard Import Fails - Result Maker IDs should not be provided Error Msg

When migrating content from one instance to another instance we get the below error when trying to import a dashboard. "Result Maker IDs should not be provided for text elements", :documentation_url=>"http://docs.looker.com/". We get this message regardless of whether it is a new import or an overwrite (force). We are leveraging the space export feature to get the json files for import.

This may be similar to #40 but have not yet been able to resolve based on comments from that issue.

gzr version - v0.2.32
Looker version - 6.24.30

Full Error Text:
Error updating dashboard_element(77,{
"body_text": null,
"dashboard_id": 10,
"look_id": null,
"merge_result_id": null,
"note_display": null,
"note_state": null,
"note_text": null,
"query_id": null,
"refresh_interval": null,
"result_maker": null,
"subtitle_text": "",
"title": null,
"title_hidden": false,
"title_text": "Title",
"type": "text"
})
Validation Failed
{:field=>"type", :code=>"invalid", :message=>"Result Maker IDs should not be provided for text elements", :documentation_url=>"http://docs.looker.com/"}

Dashboard import fails when filters have been updated.

The dashboard import method uses pairs to iterate through dashboard filters, where the data is supplied by the exported JSON data and the Looker API. This requires the dashboard filters to be in a properly sorted order. However, the Looker API seems to serialize the dashboard filters based on a private, inaccessible updated_at timestamp, so the list of dashboard filters can't be maintained between two looker instances that use gazer as the deploy mechanism.

Suggested fixes:

  1. Modify the Looker API to use a public sort_by for dashboard_filter responses (id, name, title)
  2. Modify gzr to properly match existing filters using name and title (similar to the title matching behavior of dashboards)

Consistent Repro:

  1. Create a dashboard with two filters in first looker instance.
  2. Export from the first looker instance and import the dashboard to second looker instance.
  3. Modify the first created filter in some way.
  4. Attempt to export/import the dashboard again.
  5. Import will fail with following error:
Validation Failed\n{:field=>\"[:title, :dashboard_id]\", :code=>\"already_exists\", :message=>\"Filter with this title already exists.\"}{:field=>\"[:name, :dashboard_id]\", :code=>\"already_exists\", :message=>\"Filter with this name already exists.\"}\nERROR: Validation Failed\n"}

Manage profiles

Allow a user to specify --profile=dev instead of --host=dev.looker.example.com and store the auth key instead of re-logging in each time.

Info would be stored in a file like this...

[
  {
    "profile":"dev",
    "host": "dev.looker.example.com",
    "port": "19999",
    "client_id": "XYZ",
    "client_secret": "123",
    "api_version": "3.1",
    "ssl": true,
    "verify_ssl": true,
    "token": "kahdskfhasdlkfnakls dnfkasd",
    "su_tokens": [
      {
        "user_id": 123,
        "token": "adnfkjashdfkjhaskjdbnfkasd"
      },
      {
        "user_id": 456,
        "token": "adnfkjashdfkjhaskjdbnfkasd"
      }
    ]
  },
  {
    "profile":"qa",
    "host": "qa.looker.example.com",
    "client_id": "XYZ",
    "client_secret": "123",
    "token": "kahdskfhasdlkfnakls dnfkasd"
  },
  {
    "profile":"prod",
    "host": "prod.looker.example.com",
    "client_id": "XYZ",
    "client_secret": "123",
    "token": "kahdskfhasdlkfnakls dnfkasd"
  }
]

The file would be searched for in a location optionally specified by the user, then the local dir, then each parent dir, then in the user's root dir.

The file must be permissioned as rw-------

The user would use gzr login --profile=dev to log in and save the token. A command like gzr logout --profile=dev would log out the token.

gzr login --profile=dev --su=123 would set the su token. gzr logout --profile=dev --su=123 would logout and delete the token.

-p dev:123 would be short for --profile=dev --su=123

Before any command, gzr would verify that the authorization was still good. If not it would reauthorized and save the new token.

It is possible for multiple gzr processes to use the same file, so we want to have some sort of locking.

Export User Space

I am trying to export the user space with the following Gazer command
gzr space export 2 --host HOST NAME --no-ssl --dir MY DIRECTORY
and I am getting the following error

/Library/Ruby/Gems/2.3.0/gems/gazer-0.2.8/lib/gzr/commands/space/export.rb:78:in process_space': undefined method gsub' for nil:NilClass (NoMethodError)
from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.8/lib/gzr/commands/space/export.rb:111:in block in process_space' from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.8/lib/gzr/commands/space/export.rb:110:in each'
from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.8/lib/gzr/commands/space/export.rb:110:in process_space' from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.8/lib/gzr/commands/space/export.rb:71:in block in execute'
from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.8/lib/gzr/modules/session.rb:193:in with_session' from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.8/lib/gzr/commands/space/export.rb:48:in execute'
from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.8/lib/gzr/commands/space.rb:76:in export' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/command.rb:27:in run'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in invoke_command' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor.rb:387:in dispatch'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/invocation.rb:115:in invoke' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor.rb:238:in block in subcommand'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/command.rb:27:in run' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in invoke_command'
from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor.rb:387:in dispatch' from /Library/Ruby/Gems/2.3.0/gems/thor-0.20.3/lib/thor/base.rb:466:in start'
from /Library/Ruby/Gems/2.3.0/gems/gazer-0.2.8/exe/gzr:36:in <top (required)>' from /usr/local/bin/gzr:22:in load'
from /usr/local/bin/gzr:22:in `

'

This hasn't been happening consistently, but has been happening more so since we have had a second page of users. However, it has worked with 2 pages before so I'm not sure if that is the issue.

Local setup Question

I may be confused, but if i had Looker on a hosted instance, could i still access it locally with this tool if i was running from my computer? Or does the tool need to be installed in the same location as Looker instance?

One small followup, if i wanted to move dashboards/views from one looker instance to another, would i just include both credentials in the netrc file?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.