LookML Dashboard elements have no query object

low_priority
done
reply
dashboards
(Mark K) #1

Hi all,

I am trying to do a simple API request to get a Dashboard and then run through the Dashboard elements, running inline queries. I am using the run_dashboard_queries.py file in the python_api_samples as an example. I’ve noticed that Dashboards created using LookML will not have a query object in the Dashboard element, causing the script to error. Dashboards created in the UI don’t seem to have this issue.

The lines in the script in question are these:

    if element['look_id'] is None:
        full_query = element['query']

look_id, look, query, and query_id are all None in the returned Dashboard’s dashboard_elements. Is there anything that needs to be set in order for these values to be returned properly?

1 Like

(Izzy) #2

Innnnteresting.

Can you check in the dashboard_element:result_maker field? I bet query will still be there. I haven’t got a chance to test this yet, but I’m going to look into why this changed and get back to you!

0 Likes

(Izzy) #3

Yep, looks like we recently changed the way that LookML dashboards store query objects, and it is nested within the result_maker field. Happy to answer any more questions if you’re still not finding it!

0 Likes

(Mark K) #4

Hi Izzy, after working through with my sales engineer Bryce, the solution was to update the code to read:

if element['look_id'] is None:
    if element['query'] is None:
        full_query = element['result_maker']['query']
    else:
        full_query = element['query']
else:
    full_query = element['look']['query']

This resolved the issue for us.

2 Likes