Broken References to Fields

modeling
lookml

(vincent) #1

How to Identify and Fix

After saving your LookML and running your LookML Validator, you might run into something like this:

There are a few reasons why this error will show – from as trivial as a typo to something a little bit more complex like non-existing fields or missing joins.
First, check for typos:
in the model file for the tables you are trying to join in or
in the view file for misspelled dimensions.
You might also want to check if you aliased any of the dimensions in the view file and then referenced them by their table name, rather than their aliased name, in another view or model file.

###For example:

Old LookML ``` - view: investments sql_table_name: crunchbase.investments fields: - dimension: fund_id type: number sql: ${TABLE}.funding_id ```
New LookML ``` view: investments { sql_table_name: crunchbase.investments ;;

dimension: fund_id {
type: number
sql: ${TABLE}.funding_id ;;
}
}

</details>



Suppose we have two tables, `investments` and `funding`.
In our investment view file, we have a foreign key, `${TABLE}.funding_id`, that joins `investments` to `funding` but aliased the dimension as `fund_id`. Then in the model file, when trying to join `funding` to `investments` we did this by accident:

<details open>
<summary>Old LookML</summary>

  • explore: investments
    joins:
    • join: funding
      type: left_outer
      sql_on: ${funding.id} = ${investments.funding_id}
</details>
<details>
<summary>New LookML</summary>

explore: investments {
join: funding {
type: left_outer
sql_on: ${funding.id} = ${investments.funding_id} ;;
}
}

</details>



This will create the _Unknown or Inaccessible_ error seen above. To fix this, simply change to
 

<details open>
<summary>Old LookML</summary>
  • explore: investments
    joins:
    • join: funding
      type: left_outer
      sql_on: ${funding.id} = ${investments.fund_id}
</details>
<details>
<summary>New LookML</summary>

explore: investments {
join: funding {
type: left_outer
sql_on: ${funding.id} = ${investments.fund_id} ;;
}
}

</details>



#What to do if the error still persists
Check out this [Discourse](https://discourse.looker.com/t/error-unknown-or-inaccessible-field/578) for more in depth troubleshooting.

(Levi Davis) #2

For each old LookML code block in this article and its comments, we just added the New LookML equivalent code.