[jira] [Commented] (FLINK-17361) Support creating of a JDBC table using a custom query

2020-05-04 Thread Flavio Pompermaier (Jira)


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

Flavio Pompermaier commented on FLINK-17361:


As I commented in the PR I named the property 'connector.read.query' because I 
saw that there's still no consensus about this property renaming. I think it 
will be safer to leave all the renaming part in a specific PR

> Support creating of a JDBC table using a custom query
> -
>
> Key: FLINK-17361
> URL: https://issues.apache.org/jira/browse/FLINK-17361
> Project: Flink
>  Issue Type: Improvement
>  Components: Table SQL / API
>Reporter: Flavio Pompermaier
>Priority: Major
>  Labels: pull-request-available
>
> In a long discussion on the mailing list it has emerged how it is not 
> possible to create a JDBC table that extract data using a custom query.
> A temporary workaround could be to assign as 'connector.table' the target 
> query.
> However this is undesirable. 
> Moreover, in relation to https://issues.apache.org/jira/browse/FLINK-17360, a 
> query could be actually a statement that requires parameters to be filled by 
> the custom parameter values provider



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (FLINK-17361) Support creating of a JDBC table using a custom query

2020-05-04 Thread Flavio Pompermaier (Jira)


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

Flavio Pompermaier commented on FLINK-17361:


For the moment I can implement it without setting the read-only property of the 
table and the user will just get an exception if it tries to insert into it.
Then, when the tables will have such a mechanism to specify the read-only 
behavior it will be pretty easy to set it.

> Support creating of a JDBC table using a custom query
> -
>
> Key: FLINK-17361
> URL: https://issues.apache.org/jira/browse/FLINK-17361
> Project: Flink
>  Issue Type: Improvement
>  Components: Table SQL / API
>Reporter: Flavio Pompermaier
>Priority: Major
>
> In a long discussion on the mailing list it has emerged how it is not 
> possible to create a JDBC table that extract data using a custom query.
> A temporary workaround could be to assign as 'connector.table' the target 
> query.
> However this is undesirable. 
> Moreover, in relation to https://issues.apache.org/jira/browse/FLINK-17360, a 
> query could be actually a statement that requires parameters to be filled by 
> the custom parameter values provider



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (FLINK-17361) Support creating of a JDBC table using a custom query

2020-05-04 Thread Jark Wu (Jira)


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

Jark Wu commented on FLINK-17361:
-

I think we can get the schema information from 
{{java.sql.PreparedStatement#getMetaData}}. 

Regarding to this issue, I like the idea of this issue (i.e. registering a JDBC 
view as a Flink table). However, we still need to figure out what happens when 
insert into this table. I don't have a clear idea right now. But I think 
registering a source-only table is an approach. However, we still need to 
introduce a mechanism to register a source-only or sink-only table in the 
framework. 

> Support creating of a JDBC table using a custom query
> -
>
> Key: FLINK-17361
> URL: https://issues.apache.org/jira/browse/FLINK-17361
> Project: Flink
>  Issue Type: Improvement
>  Components: Table SQL / API
>Reporter: Flavio Pompermaier
>Priority: Major
>
> In a long discussion on the mailing list it has emerged how it is not 
> possible to create a JDBC table that extract data using a custom query.
> A temporary workaround could be to assign as 'connector.table' the target 
> query.
> However this is undesirable. 
> Moreover, in relation to https://issues.apache.org/jira/browse/FLINK-17360, a 
> query could be actually a statement that requires parameters to be filled by 
> the custom parameter values provider



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Commented] (FLINK-17361) Support creating of a JDBC table using a custom query

2020-05-04 Thread Flavio Pompermaier (Jira)


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

Flavio Pompermaier commented on FLINK-17361:


[~jark] or [~Leonard Xu]: is there a way to automatically infer the column info 
from the query? It could be quite annoying for the users to specify all the 
column fields names and types. 

I was going to introduce a new 'scan.query' property for this ticket, then I 
faced another problem : how can I set 'connector.table'? 
In a statement like the following, is there a way to set 'connector.table' to 
the user table name (i.e. MyUserTable)? Or do I have to autogenerate an Id 
somehow?

{code:sql}
CREATE TABLE MyUserTable (
  ...
) WITH (
  'connector.type' = 'jdbc', 
  'connector.url' = 'jdbc:mysql://localhost:3306/flink-test',  
  'scan.query' = 'select x.a, y.b FROM X JOIN Y ON X.k = Y.k',
{code}

  

> Support creating of a JDBC table using a custom query
> -
>
> Key: FLINK-17361
> URL: https://issues.apache.org/jira/browse/FLINK-17361
> Project: Flink
>  Issue Type: Improvement
>  Components: Table SQL / API
>Reporter: Flavio Pompermaier
>Priority: Major
>
> In a long discussion on the mailing list it has emerged how it is not 
> possible to create a JDBC table that extract data using a custom query.
> A temporary workaround could be to assign as 'connector.table' the target 
> query.
> However this is undesirable. 
> Moreover, in relation to https://issues.apache.org/jira/browse/FLINK-17360, a 
> query could be actually a statement that requires parameters to be filled by 
> the custom parameter values provider



--
This message was sent by Atlassian Jira
(v8.3.4#803005)