flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-10163) Support CREATE VIEW in SQL Client
Date Mon, 27 Aug 2018 14:01:00 GMT

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

ASF GitHub Bot commented on FLINK-10163:
----------------------------------------

twalthr commented on a change in pull request #6606: [FLINK-10163] [sql-client] Support views
in SQL Client
URL: https://github.com/apache/flink/pull/6606#discussion_r212985602
 
 

 ##########
 File path: docs/dev/table/sqlClient.md
 ##########
 @@ -459,6 +466,50 @@ Web interface: http://localhost:8081
 
 {% top %}
 
+SQL Views
+---------
+
+Views allow to define virtual tables from SQL queries. The view definition is parsed and
validated immediately. However, the actual execution happens when the view is accessed during
the submission of a general `INSERT INTO` or `SELECT` statement.
+
+Views can either be defined in [environment files](sqlClient.html#environment-files) or within
the CLI session.
+
+The following example shows how to define multiple views in a file:
+
+{% highlight yaml %}
+views:
+  - name: MyRestrictedView
+    query: "SELECT MyField2 FROM MyTableSource"
+  - name: MyComplexView
+    query: >
+      SELECT MyField2 + 42, CAST(MyField1 AS VARCHAR)
+      FROM MyTableSource
+      WHERE MyField2 > 200
+{% endhighlight %}
+
+Similar to table sources and sinks, views defined in a session environment file have highest
precendence.
+
+Views can also be created within a CLI session using the `CREATE VIEW` statement:
+
+{% highlight text %}
+CREATE VIEW MyNewView AS SELECT MyField2 FROM MyTableSource
+{% endhighlight %}
+
+The `SHOW VIEW` statement allows for printing a previously created view again:
 
 Review comment:
   FYI: In MySQL it is called [SHOW CREATE VIEW](https://dev.mysql.com/doc/refman/8.0/en/show-create-view.html)
and many vendors don't even offer this functionality which I find weird (e.g. Snowflake only
shows the schema for [DESCRIBE VIEW](https://docs.snowflake.net/manuals/sql-reference/sql/desc-view.html)).
   
   I'm fine with removing `SHOW VIEW` for now?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Support CREATE VIEW in SQL Client
> ---------------------------------
>
>                 Key: FLINK-10163
>                 URL: https://issues.apache.org/jira/browse/FLINK-10163
>             Project: Flink
>          Issue Type: New Feature
>          Components: Table API &amp; SQL
>            Reporter: Timo Walther
>            Assignee: Timo Walther
>            Priority: Major
>              Labels: pull-request-available
>
> The possibility to define a name for a subquery would improve the usability of the SQL
Client. The SQL standard defines \{{CREATE VIEW}} for defining a virtual table.
>  
> Example:
> {code}
>  CREATE VIEW viewName
>  [ '(' columnName [, columnName ]* ')' ]
>  AS Query
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message