Is it possible to find the queries in BigQuery triggered by "looker studio"/ "data studio" using INFORMATION_SCHEMA.JOBS_BY_PROJECT?

437 Views Asked by At

I am trying to find the queries that are being executed using looker studio / data studio using the table INFORMATION_SCHEMA.JOBS_BY_PROJECT. My objective is to measure the BigQuery consumption in terms of types of execution {"looker_studio, tableau, adhoc queries, scheduled queries"}

1

There are 1 best solutions below

0
Nicolás Rodríguez Celis On

It seems I found a solution. Check this query:

WITH
  select_main_results AS (
    SELECT
      label.key,
      label.value
    FROM
      `region-us`.INFORMATION_SCHEMA.JOBS_BY_PROJECT jobs,
      UNNEST(jobs.labels) label
    WHERE 
      DATE(creation_time)>= DATE("2023-08-01")
  )
  SELECT
    DISTINCT
      key,
      value
  FROM
    select_main_results
  WHERE
    key != "dts_run_id"

This gives this result

key value
data_source_id  scheduled_query
sheets_connector    connected_sheets
sheets_trigger  schedule
sheets_trigger  user
requestor   looker_studio
sheets_access_type  normal

it seems like using requestor as key in the labels record could identify the queries executed from looker studio.