View the original community article here
Last tested: March 2021
Problem
You receive a LookML error that complains about an unknown view. The error takes the form:
Unknown view “my_view”. View “my_view” does not exist in model “my_model”. Check for typos or missing include statements in “my_model”.
Solution 1
The most simple reason for this error is, as the error states, someone simply forgot to include that view into the model. Or perhaps the view name is misspelled!
If the include statement specifies the view, but the warning triangle states "This include does not match any files," confirm that the proper folder path has been written for the include statement.
Solution 2
A second, much more complex reason is when the view is renamed with from
. Generally, it is best to use view_name when you don't need to rename the view, such as when using extends
, and reserve from
when you need to change how the view is referenced, such as joining a view to an explore more than once.
Example when using from
with extends
-
When using
from
, you reference fields usingexplore_name.field_name
. -
When using
view_name
, you reference fields usingview_name.field_name
.
The from
parameter causes a big problem when extending, because now the explore name has changed!
# CODE WHICH ERRORS
explore: my_explore {
from: my_view
join: other_view { sql_on: ${my_explore.field1} = ${other_view.field1};;
}
explore: new_explore {
extends: [my_explore]
}
Inside new_explore
, the join on line 5 is brought through but the reference to my_explore
fails because the explore name is now new_explore
.
To fix this, use view_name
instead!
# CODE WHICH DOES NOT ERROR (we changed lines 4 and 5 only)
explore: my_explore {
view_name: my_view
join: other_view { sql_on: ${my_view.field1} = ${other_view.field1};;
}
explore: new_explore {
extends: [my_explore]
}
Now, the reference on line 5 is only based on the view, not the explore. So when it's brought into new_explore
via extends, the reference is still valid. The key is that there are now no references to the old explore name (my_explore
)!
This content is subject to limited support.