What happens when we have from and view_name together?

Knowledge Drop

Last tested: Oct 21, 2019
 

When you use from and view_name together, from tells Looker what view to actually pull from and view_name can literally be anything. (per Paola)

So for example, say we have something like this:

explore: extension_hidden {  

extension: required  

view_name: any_name_that_i_want  

join: products {    

sql_on: ${products.id} = ${any_name_that_i_want.id} ;;    

type: left_outer    

relationship: one_to_one  

}

}

explore: order_items_3 {  

extends: [extension_hidden]  

from: orders}

The SQL generated in the UI will look like this:

SELECT    

any_name_that_i_want.id  AS `any_name_that_i_want.id`,

products.brand  AS `products.brand`

FROM demo_db.orders  AS any_name_that_i_want

LEFT JOIN demo_db.products  AS products ON products.id = any_name_that_i_want.id

This content is subject to limited support.                

Version history
Last update:
‎07-07-2021 01:14 PM
Updated by: