How to comment on an entire block of code in the LookML editor of Looker.

  • Datameer, Inc.
  • January 22, 2018
Get Started Transforming Your Data in Snowflake

In Looker, one can follow the below instructions to comment a block of code in LookML editor : 

  1. Select the lines which are required to be commented out.
  2. Press ⌘ + / on a Mac, or ctrl + / on a Windows computer.

The code should now be commented out with a # symbol like this:

#    dimension: example { 
#    type: string
#    sql: ${TABLE}.example ;;
#    }

Commenting out a piece of code in a SQL Block:  

If one comment on outlines that are entirely within a SQL code block, one would have to add general SQL comment notations manually.

1: Multi-line comments using /* and /*:

- view: example_facts
  derived_table:
    sql: 
      /*
       SELECT
       id, COUNT(*)
       FROM example_table
       GROUP BY id
       /*

 

2: Single line comments using (–):

- view: example_facts
  derived_table:
   sql: 
      SELECT
         id, COUNT(*)
         -- , MAX(date) as most_recent_date
       FROM example_table
       GROUP BY id

Up Next:

Read How to capture the count of records for a date between two dates in Looker?