Question

Reference aliased join from main_explore explore


Hello friends.

I have in a explore main_explore 2 joins: one is parent and other is children from: parent (this is for doing alias if I need to do join parent explore more than once). In the main_explore explore I have a dimension reference to the children as sql: case when ${children.attribute}... but the validation shows an error View "children" does not exists in the model "main" and same but for model embed. Obviusly, will not exists because is an alias of parent, and I cannot declare it in the main model. Any suggestion?


Example:


main
explore: conversations{
...

join: users{
view_label: "Assigned Agents"
type: left_outer
relationship: many_to_one
sql_on: ${conversations.get_agent} = ${users.user_id} ;;
}
join: messaging_agents {
from: users
view_label: "Messaging Agents"
type: left_outer
relationship: many_to_one
sql_on: ${messages.created_by} = ${messaging_agents.user_id} ;;
}
}
///////////////////
conversations

#dimensions
dimension: hub_team{
type: string
sql: CASE
WHEN ${users.name} ilike 'xxxx' then 'ccc'
WHEN ${users.name} ilike 'xxxx' then 'dddd'
END;;
}
dimension: hub_team_messaging{
label: "Hub team (Messaging agent)"
type: string
sql: CASE
WHEN ${messaging_agents.name} ilike 'xxxxx' then 'ccc'
WHEN ${messaging_agents.name} ilike 'yyyyy' then 'dddd'
END;;
}

3 replies

Userlevel 7
Badge +1

In your example lookml below, the error would be View "messaging_agents" does not exists in the model "main"?


I tried to replicate with your LookML example, but I couldn’t replicate the error. The error you’re specifically referencing is generally related to missing includes: statements, not any wacky extends stuff. Could you make sure you’re including the relevant view files in the model main? Even just trying to add include: "*.view.lkml" to test and see if that resolves the issue would be worthwhile.

I totally got the same issue Aitor Cereceto.


In our case, let’s say we have View Users, and has been joined to an Explore called Orders. Then we added a second join of the same Users View using from with an alias of Users_info. This should give us an Explore named Orders with 3 Views in it: 1) Orders, 2) Users, 3) Users_info, however, it is not possible to interact with the aliased view Users_info in the Orders View because LookML shows an issue that it can’t find the aliased View. It won’t find it as a file itself since it’s only available when the Explore is created since its an alias of a view with a different name.


Our way to fix it was make a new View named Users_info extending the Users view, which defeats the purpose of being able to join the same view multiple times with different alias I know… but it was the only way LookML would validate.


Is this something that would be fixed in a new release?

+1

Reply