Question

Query ID

  • 10 January 2021
  • 1 reply
  • 61 views

How to get the query Id from looker?


1 reply

Userlevel 3
Badge

Hi @Rit2804,

 

You can use system activity or /admin/queries when the query is run and look at the details section. It will also appear to the right of the source column on the main page of /admin/queries when run. Or you can get the slug in the url of the query and use the query_for_slug endpoint

 

q = sdk.query(query_id=ID)
print(q.fields)

q2 = sdk.query_for_slug(slug="SLUG")
print(q2.fields)

 

An example system activity query would look like this:
HOSTNAME/explore/system__activity/history?fields=query.id,query.link,query.model,query.slug,user.email,user.id,query.formatted_fields&sorts=query.id&limit=500&query_timezone=UTC&vis=%7B%7D&filter_config=%7B%7D&origin=share-expanded

 

Please let me know if you have any questions.

 

Thanks,

Eric

Reply