Inaccessible view error on derived table

I’ve got a couple of tables in my data that require being joined to other tables in order to calculate certain fields correctly. What I’ve done is add a derived_table to a view file like this:

- view: table1_with_table2
  derived_table
    sql: |
      SELECT ...
        FROM table1 t1 JOIN table2 t2 ON t1.table1_pk = t2.table1_fk
       WHERE ...

I then reference this view in an explore definition:

 - explore: table1_explorer
   view: table1_with_table2
   always_join: 
   sql_always_where: ...
   joins:
     - join: table1
       relationship: one_to_one
       sql_on: ${table1_with_table2.table1_pk} = ${table1.table1_pk}
     - join: table2
       relationship: one_to_one
       sql_on: ${table1_with_table2.table2_pk} = ${table2.table2_pk}
   # other joins

But the validator produces at error like: Inaccessible view "table1_with_table2". "table1_with_table2" is not accessible in explore "my_explores". The first thing that occurred to me (based on error messaging was to check that the right view files are included in the explore file, but I’m pretty sure it is because this line is at the top of the explore:

- include: "*.view.lookml"

What else could cause this? Is there any strange rules about derived_table accessibility that I may have missed?

0 1 790
1 REPLY 1

It looks like my issue is merely because I neglected to use the SQL_TABLE_NAME syntax as documented here: https://docs.looker.com/data-modeling/learning-lookml/derived-tables#referencing_derived_tables_in_o...

Top Labels in this Space
Top Solution Authors