Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dashboard validation failure on import #189

Closed
jlu2 opened this issue May 4, 2023 · 21 comments · Fixed by #195
Closed

dashboard validation failure on import #189

jlu2 opened this issue May 4, 2023 · 21 comments · Fixed by #195

Comments

@jlu2
Copy link

jlu2 commented May 4, 2023

Hi,

when I try to import a dashboard from json. I don't get an error summary on what exactly causes the dashboard validation failure. this is what i get.. any reason why or how can i find out the exact reason for validation failure? I am already using --debug to run the import.

The json file is the json file that i use gzr cat to generate the json.

"preferred_viewer": "dashboards-next",
"alert_sync_with_dashboard_filter_enabled": false,
"crossfilter_enabled": false,
"enable_viz_full_screen": true,
"filters_bar_collapsed": false,
"filters_location_top": true,
"load_configuration": "cache_run",
"lookml_link_id": "xxxxx",
"deleted": false,
"slug": "",
"folder_id": "333",
"user_id": "45"
})
POST https:/xxxxx/api/4.0/dashboards: 422 - Validation Failed
// See: https://cloud.google.com/looker/docs/r/err/4.0/422/post/dashboards
// And: https://marketplace-api.looker.com/errorcodes/422.md

/usr/local/lib/ruby/gems/3.2.0/gems/looker-sdk-0.1.4/lib/looker-sdk/response/raise_error.rb:37:in on_complete' /usr/local/lib/ruby/gems/3.2.0/gems/faraday-1.10.3/lib/faraday/middleware.rb:19:in block in call'
/usr/local/lib/ruby/gems/3.2.0/gems/faraday-1.10.3/lib/faraday/response.rb:61:in on_complete' /usr/local/lib/ruby/gems/3.2.0/gems/faraday-1.10.3/lib/faraday/middleware.rb:18:in call'
/usr/local/lib/ruby/gems/3.2.0/gems/faraday-1.10.3/lib/faraday/rack_builder.rb:154:in build_response' /usr/local/lib/ruby/gems/3.2.0/gems/faraday-1.10.3/lib/faraday/connection.rb:516:in run_request'

@drstrangelooker
Copy link
Collaborator

Can you provide more info?

@jlu2
Copy link
Author

jlu2 commented May 4, 2023

so when i do
step 1) use gzr dashboard cat measurement::measurement --host=xxx --port=443 —dir ./
step 2) rename the json from step 1 to new.json
step 3) gzr dashboard import new.json '333' --host=xxxx --port=443

I get a dashboard validation error as above with no specific error. Is there other information you are looking for?

@drstrangelooker
Copy link
Collaborator

drstrangelooker commented May 4, 2023 via email

@jlu2
Copy link
Author

jlu2 commented May 4, 2023

I am using v0.3.2 actually. i don't see the error summary as some of the other posts.

@drstrangelooker
Copy link
Collaborator

drstrangelooker commented May 4, 2023 via email

@jlu2
Copy link
Author

jlu2 commented May 5, 2023

thanks for the suggestion! I tried to do gzr dashboard cat measurement::measurement --host=xxx.looker.com --trim > test.json
and then import again using gzr dashboard import test.json '333' --host=xxxx.looker.com --port=443 --debug

I still don't get the error summary.. any other suggestions i could try?

@drstrangelooker
Copy link
Collaborator

drstrangelooker commented May 5, 2023 via email

@jlu2
Copy link
Author

jlu2 commented May 5, 2023

Yes it's a lookml dashboard. was it always not supported? we been using gzer to export the lookml dashboard into json (saved to git) then export to UDD in an automated process for a year now. it only started breaking since gzr upgraded to 0.2.9

@drstrangelooker
Copy link
Collaborator

drstrangelooker commented May 5, 2023 via email

@drstrangelooker
Copy link
Collaborator

Version 0.3.5 has a command gzr dashboard import_lookml DASHBOARD_ID FOLDER_ID will copy the LookML dash to the folder as a UDD. The --unlink switch can be added to make the dashboard unlinked from the lookml.

@jlu2
Copy link
Author

jlu2 commented May 8, 2023

Great thank you!!

@ppremathas
Copy link

This is great - thank you Mike! I was able to use the new command and import the dashboard to a folder successfully.
However, I have this dashboard added to a couple of boards, so when I try to import the dashboard a second time after I made some lookml updates, the dashboard is overwritten in the folder like I expected but they have been removed from the boards since it is being treated as a new dashboard.
Is there a way to ensure the boards don't lose the linked dashboards?

@drstrangelooker
Copy link
Collaborator

drstrangelooker commented May 8, 2023 via email

@ppremathas
Copy link

ppremathas commented May 8, 2023

Sure. I was able to successfully deploy a dashboard 'abc' under a specific target folder after I ran the command gzr dashboard import_lookml abc::abc '334' --force.
Next I then added this abc dashboard to a Board A.
I then made and saved some updates to the lookml dashboard abc::abc, so I wanted to re-deploy this dashboard again to the same target folder so I re-ran the same command: gzr dashboard import_lookml abc::abc '334' --force

I expected the target folder to now have the updated abc dashboard (to overwrite the old version) and it did.

I also expected Board A which had the abc dashboard to be updated automatically as well but instead Board A was now empty.
When now looking at the updated abc dashboard, I noticed the URL link changed from "...dashboards/935" to "...dashboards/936"

Is there a way to preserve the same URL for when re-deploying a dashboard using this gazer command, so that any board(s) referencing the dashboard doesn't break?

@drstrangelooker
Copy link
Collaborator

drstrangelooker commented May 9, 2023 via email

@drstrangelooker
Copy link
Collaborator

I figured this out. There is a separate API call to sync the state of a UDD linked to a lookml dashboad. So I'm in the process of creating a new command to use that API call.

gzr dashboard sync_lookml LOOKML_DASHBOARD_ID will update the state of any UDD associated with the lookml dashboard after a lookml dashboard is edited. I'll push this code later today or tomorrow.

@ppremathas
Copy link

Thanks Mike for the quick solution! Just curious, so once you have pushed this code later, how can one execute the process of re-deploying a lookml dashboard to a target folder (overwrite) and preserve the same dashboard URL?

Will the sync_lookml be called within the import_lookml?

@drstrangelooker drstrangelooker linked a pull request May 9, 2023 that will close this issue
@drstrangelooker
Copy link
Collaborator

how can one execute the process of re-deploying a lookml dashboard to a target folder (overwrite) and preserve the same dashboard URL?

You only do the deploy once. Looker remembers the linkage. When you change the lookml dash, run gzr dashboard sync_lookml LOOKML::DASHBOARD_ID and the linked dashboards just get updated.

@drstrangelooker
Copy link
Collaborator

drstrangelooker commented May 9, 2023

You should be all set to go. 0.3.6 has been released. Just gem update gazer.

edit: sorry update rather than upgrade.

@ppremathas
Copy link

Thanks Mike - this is great!

Just wondering if we can introduce a new command that would have the capability to check if a lookml dashboard is deploying for the first time to a target folder as UDD, then use import_lookml otherwise (if already exists) use sync_lookml.

If I am trying to do that manually, I have to somehow retrieve the lookml's title and compare that to the existing UDD's title. The problem is how to retrieve the a lookml dashboard's title?

@drstrangelooker
Copy link
Collaborator

OK, I just released a new version. If you add the --sync flag to import_lookml it will do a sync if the dashboard has the same title and is linked to the lookml dash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants