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

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

  • Post category:Looker
  • Post last modified:February 13, 2023
  • Reading time:6 mins read

Looker is a powerful business intelligence and data analytics platform that allows users to easily build and manage data models, create data reports and dashboards, and access valuable insights from their data. One of the key components of the Looker platform is the LookML editor, which provides a powerful coding environment for defining and building data models in LookML.

In this blog post, we will take a look at how to comment out an entire block of code in the LookML editor. This can be useful when you need to temporarily remove a section of code from your model or when you want to annotate your code for future reference.

To comment out a block of code in the LookML editor, simply select the text that you want to comment out and press Cmd + / (Mac) or Ctrl + / (Windows). This will add a comment symbol (#) to the beginning of each line of the selected text, effectively commenting it out and rendering it inactive in your code.

If you want to uncomment the code, simply select the commented-out text and press the same shortcut key again. The comment symbols will be removed, and the code will be active once again.

Below is an example of how to use this feature in practice. In Looker, you 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

More Imp Topics

How Looker Writes SQL?

How to calculate percent of total in looker?

Table Calculations in Looker

What are Derived tables in Looker?

How to set conditional formatting in LOOKER?

Looker Interview Questions And Answers

New Looker Performance Recommendations Dashboard

Looker Git Version Control: How To Revert To A Specific Commit In Looker, No Git Commands Necessary

Reference :

About Me:-
I am Om Prakash Singh – Data Analytics Consultant , Looker Consultant , Solution Architect .
I am Highly analytical and process-oriented Data Analyst with in-depth knowledge of database types; research methodologies; and big data capture, manipulation and visualization. Furnish insights, analytics and business intelligence used to advance opportunity identification.

You’ve got data and lots of it. If you’re like most enterprises, you’re struggling to transform massive information into actionable insights for better decision-making and increased business results.
Reach out to us if you are interested to evaluate if Looker is right for you or any other BI solution.

Leave a Reply