How to comment out a block of code

In order to comment out an entire block of code in the LookML editor, following these steps:

  1. Select the lines you want to comment out
  2. Press ⌘+/ on a Mac, or ctrl+/ on a Windows computer

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

#  - dimension: id                         
#    type: int
#    primary_key: true
#    sql: ${TABLE}.id 

Read about all the keyboard shortcuts available in Looker here.

Commenting out SQL blocks

If you are commenting out lines that are entirely within a SQL code block, you will want to manually add SQL comment notation. Note that SQL comments must appear only in SQL blocks that are indented beyond the LookML parameter above it. This looks like:

Multi-line comments:

- view: user_order_facts
  derived_table:
    sql: |
      /*
      SELECT
         users.id as user_id
         , COUNT(*) as lifetime_orders
         , MAX(orders.date) as most_recent_purchase_date
       FROM orders
       GROUP BY user.id
       /*

Single line comments:

- view: user_order_facts
  derived_table:
    sql: |
      SELECT
         users.id as user_id
         , COUNT(*) as lifetime_orders
         -- , MAX(orders.date) as most_recent_purchase_date
       FROM orders
       GROUP BY user.id
3 1 14.3K
1 REPLY 1

how do you uncomment?

Top Labels in this Space
Top Solution Authors