You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Rushabh Shah (Jira)" <ji...@apache.org> on 2022/12/20 18:45:00 UTC

[jira] [Updated] (PHOENIX-6847) Provide a crisp API to check if a view exists.

     [ https://issues.apache.org/jira/browse/PHOENIX-6847?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rushabh Shah updated PHOENIX-6847:
----------------------------------
    Description: 
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 schemaName, String viewName, String tenantID);
{noformat}

  was:
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}





> 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 schemaName, String viewName, String tenantID);
> {noformat}



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