[ 
https://issues.apache.org/jira/browse/FLINK-32958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17759521#comment-17759521
 ] 

Xianxun Ye commented on FLINK-32958:
------------------------------------

[~fornaix]  I think CTAS syntax may be helpful in your case. 

https://issues.apache.org/jira/browse/FLINK-24567

> Support VIEW as a source table in CREATE TABLE ... Like statement
> -----------------------------------------------------------------
>
>                 Key: FLINK-32958
>                 URL: https://issues.apache.org/jira/browse/FLINK-32958
>             Project: Flink
>          Issue Type: Improvement
>          Components: Table SQL / Planner
>    Affects Versions: 1.17.1
>            Reporter: Han
>            Priority: Major
>              Labels: pull-request-available
>
> We can't create a table from a view through CREATE TABLE LIKE statement
>  
> case 1:
> {code:sql}
> create view source_view as select id,val from source;
> create table sink with ('connector' = 'print') like source_view (excluding 
> all);
> insert into sink select * from source_view;{code}
> case 2
> {code:java}
> DataStreamSource<Entity> source = ...;
> tEnv.createTemporaryView("source", source);
> tEnv.executeSql("create table sink with ('connector' = 'print') like source 
> (excluding all)");
> tEnv.executeSql("insert into sink select * from source");{code}
>  
> The above cases will throw an exception:
> {code:java}
> Source table '`default_catalog`.`default_database`.`source`' of the LIKE 
> clause can not be a VIEW{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to