Query error: Table not found, failed to parse view

Problem

Failed to parse view due to table not found error in BigQuery, even though the table is present at the specified path. The error is of the following format:
Table not found: 'project-id:dataset-name.table-name'; failed to parse view 'project-id.dataset-name.view-name' at [XY:ZX]

Environment

  • BigQuery

Solution

  1. Make the dialects between the query and the view definition consistent should resolve the error.
    • For example, if the view definition is written using the standard dialect, the query written to query the view has to be written using the standard dialect as well.

Cause

Upon inspecting the error string, we can see that the table which is not found is following Legacy SQL dialect as it has a colon after the project-id. The view definition is following Standard SQL dialect as it has a full-stop after the project-id.

Considering this insight, we can ascertain that the dialects being used are different between the query in the editor and the view definition, as a consequence of this difference we get a 'failed to parse view'.

As per documentation for BigQuery Views the dialects need to be consistent.