If using `from:` in an Explore or Join, what view name do I reference in my sql_on statement?

Knowledge Drop

Last tested: Jan 21, 2019

If you are using the from: in an Explore or Join, you are essentially aliasing the from: view_name as the Explore name. So you should use the explore name, rather than the view name.

For example,

explore: my_explore_name {

from: view_name_A

join: view_name_B {

type: left_outer

relationship: many_to_one

sql_on: ${my_explore_name.id} = ${view_name_B.id} ;;

}

}

If you attempt to use sql_on: ${view_name_A.id} = ${view_name_B.id} ;;, you will see a “cannot find field” error message.

Tip: If from is omitted, Looker will assume that the underlying name is the same as either the Explore or the Join view name.