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

Istvan Toth commented on PHOENIX-6847:
--------------------------------------

I mostly agree with [~jisaac] .
I see no problem with the JDBC compliant snippet show above either.

However, if we do decide to provide a Phoenix-specific API for this, IMO 
PhoenixRuntime would be the place to put it.
I agree that end users have no business accessing internal classes like PTable.

What is the problem with the JDBC way ? Is it performance ?
What would be the use case for the new API ?

> Provide a crisp API to check if a view exists.
> ----------------------------------------------
>
>                 Key: PHOENIX-6847
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-6847
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Rushabh Shah
>            Priority: Major
>
> Currently customer using phoenix runs the following statements to check if a 
> view exists or not.
> {noformat}
>   public static boolean checkTableViewExists(Connection connection, String 
> schema, String viewName)
>       throws SQLException {
>     DatabaseMetaData meta = connection.getMetaData();
>     ResultSet resultSet = meta.getTables(null, schema, viewName, new String[] 
> {"VIEW"});
>     return resultSet.next();
>   }
> {noformat}
> IMHO this is NOT very user friendly.
> We need to provide either of the 2 APIs
> {noformat}
> public PTable getView(String viewName, String tenantID);  OR 
> public boolean viewExists(String viewName, String tenantID);
> {noformat}



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

Reply via email to