Uses of if dev


The Derived Tables documentation reads:

Looker supports a conditional WHERE clause for dev mode that helps manage this:

- view: my_view
    sql: |
        -- if prod -- date > '2000-01-01'
        -- if dev -- date > '2015-01-01'

In this example the query will include all data from 2000 onward when in production, but only the data from 2015 onward when in dev mode.

  1. Does this feature exist for SQL where clauses outside of derived tables, e.g. in measures or dimensions?

  2. Does this feature exist for SQL clauses other than where, e.g. from tbl -- if dev -- partition (p1)?

  3. Does it exist outside of SQL, e.g. -- if prod -- hidden:true for fields or explores, perhaps with different syntax?

If not, consider this a request. :-)

(Brett Sauve) #2

Hey @Michael, the answer to each of your questions is no; this functionality only works in the sql parameter of a derived table. We’ve been thinking about potentially treating hidden fields differently between dev and prod mode, but having a generic ability to change behavior between dev and prod is interesting. I’ll open a feature request for you.

(Michael Dunn) #3

For anyone finding this thread, -- if dev -- foo and -- if prod -- bar both work in other places in the SQL as well - not just the where clause.

This works:

derived_table: {
      -- if dev -- some_dev_schema.some_table
      -- if prod -- some_prod_schema.some_table