Query Failed Error: Views cannot be queried through prefix. Partial list of the matched views are

痴心易碎 提交于 2020-02-04 05:47:06

问题


I am trying to query a dataset with multiple tables and equivalent views. I am trying to query just the tables using _table_suffix, but it returns an error "Query Failed Error: Views cannot be queried through prefix. Partial list of the matched views-......" I cannot remove the views from the dataset. Is there a way to query the tables only and ignore the views?

SELECT COUNT(*), _table_suffix, DATE(created)
FROM `dataset.viewed_*`
WHERE _table_suffix like '%_page'

回答1:


Your options are:

  • Recreate the views under different names, so that the viewed_ prefix doesn't match them.
  • Use a longer prefix than viewed_ (if possible) when matching the table names, so that the view names aren't included.
  • Migrate your tables to a single partitioned table so that you don't need to use a wildcard.

I would suggest the third option if at all possible; using a partitioned table is much better than trying to maintain multiple tables with a common schema.



来源:https://stackoverflow.com/questions/52521822/query-failed-error-views-cannot-be-queried-through-prefix-partial-list-of-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!