Context Comments

(gustav.staprans) #1

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

Example:

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

(Ian) #2

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?

0 Likes

(Brecht Vermeire) #3

@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.

0 Likes

#4

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

0 Likes

(Brecht Vermeire) #5

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.

0 Likes

#6

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).

0 Likes

(Ian) #7

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

0 Likes

(Brecht Vermeire) #8

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

0 Likes

#9

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.

0 Likes