Context Comments

  • 7 November 2017
  • 9 replies

Please see this documentation page for comprehensive information.

A labs feature to add a SQL comment to the beginning of any outgoing query. This is useful for DB Admins who want to see which user ran which specific query.

This applies to:

  • filter suggestions

  • sql runner

  • explore queries

  • api_queries


         -- Query Context '{ user_id: 1, history_id: 1 }'
SELECT my_field
FROM my_database.my_table

9 replies

Userlevel 6

This is great and something which we almost hacked together our self however it would have impacted caching as the comments were part of the query.

Does this new functionality get around this so that the comments are not involved in the cache hash comparison and the comments are also not saved in the application database so we wont see them in ilooker model/database?

Userlevel 4

@IanT - That’s correct, the Context Comments feature does not invalidate cache. Cached results are based on the raw SQL, which excludes the comments added through the Context Comments labs feature.

This is really useful thanks! Hoping the comment also includes the query source, ie explore / SQL runner / etc…?

Userlevel 4

Only the user_id and history_id are included at the moment @jesko. Both can be looked up from within the i__looker and query metadata is retained in Looker’s internal database for 90 days. The history_id is unique for each query and can be used to look up more metadata through the i__looker models. This article has some great insights on how to leverage this model.

Perfect thanks @brecht, yes I’m familiar with i__looker (we use it quite a bit although we’d absolutely love to be able to manually query the underlying data or change the LookML for i__looker so it’s more comprehensive).

Userlevel 6

huge +1 on this. With the xproject functionality it should be a read only extendable project, would add a huge amount of possibilities.

Userlevel 4

@IanT, @jesko - thanks for the feedback guys - I’ve passed it on to our product team over here.

Ditto @IanT, i__looker has traditionally answered only around 20-40% of the questions we’ve had that can actually be answered with the underlying data.

Is it possible to add custom comments, like the name of the dashboard this query run into?

The IDs added today are not at all useful if you want to trace the query performance in the original database system, like Snowflake.