简体   繁体   English

无法在红移光谱外部模式中创建视图

[英]cannot create a view in redshift spectrum external schema

I am facing an issue in creating a view in an external schema on a spectrum external table.我在频谱外部表的外部模式中创建视图时遇到问题。 Below is the script I am using to create the view下面是我用来创建视图的脚本

create or replace view external_schema.test_view as
select id, name from external_schema.external_table with no schema binding;

I'm getting below error我得到以下错误

ERROR: Operations on local objects in external schema are not enabled.错误:未启用对外部架构中本地对象的操作。

Please help in creating view under spectrum external table请帮助在频谱外部表下创建视图

External tables are created in an external schema.外部表是在外部模式中创建的。 An Amazon Redshift External Schema references a database in an external Data Catalog in AWS Glue or in Amazon Athena or a database in Hive metastore, such as Amazon EMR. Amazon Redshift 外部架构引用 AWS Glue 或 Amazon Athena 中的外部数据目录中的数据库或 Hive 元存储中的数据库,例如 Amazon EMR。

External schemas are not present in Redshift cluster, and are looked up from their sources. Redshift 集群中不存在外部模式,而是从它们的源中查找。 External tables are also only read only for the same reason.出于同样的原因,外部表也是只读的。

As a result, you will not be able to bind a view that you are creating to a schema not is not stored in the cluster.因此,您将无法将您正在创建的视图绑定到未存储在集群中的模式。 You can create a view on top of external tables (WITH NO SCHEMA BINDING clause), but the view will reside in a schema local to Redshift.您可以在外部表之上创建一个视图(没有 SCHEMA BINDING 子句),但该视图将驻留在 Redshift 本地的架构中。

TL;DR Redshift doesn't support creating views in external schemas yet, so the view can only reside in a schema local to Redshift. TL;DR Redshift 还不支持在外部模式中创建视图,因此视图只能驻留在 Redshift 本地的模式中。

Replace external_schema with internal_schema as follows:external_schema替换为internal_schema ,如下所示:

create or replace view internal_schema.test_view as
select id, name from external_schema.external_table with no schema binding;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM