twalthr commented on a change in pull request #16962:
URL: https://github.com/apache/flink/pull/16962#discussion_r782079556



##########
File path: 
flink-connectors/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/catalog/AbstractJdbcCatalog.java
##########
@@ -188,8 +205,72 @@ public void alterDatabase(String name, CatalogDatabase 
newDatabase, boolean igno
         throw new UnsupportedOperationException();
     }
 
+    @Override
+    public CatalogDatabase getDatabase(String databaseName)
+            throws DatabaseNotExistException, CatalogException {
+
+        Preconditions.checkState(
+                org.apache.commons.lang3.StringUtils.isNotBlank(databaseName),
+                "Database name must not be blank.");
+        if (listDatabases().contains(databaseName)) {
+            return new CatalogDatabaseImpl(Collections.emptyMap(), null);
+        } else {
+            throw new DatabaseNotExistException(getName(), databaseName);
+        }
+    }
+
     // ------ tables and views ------
 
+    @Override
+    public CatalogBaseTable getTable(ObjectPath tablePath)
+            throws TableNotExistException, CatalogException {
+
+        if (!tableExists(tablePath)) {
+            throw new TableNotExistException(getName(), tablePath);
+        }
+
+        String dbUrl = baseUrl + tablePath.getDatabaseName();
+
+        try (Connection conn = DriverManager.getConnection(dbUrl, username, 
pwd)) {

Review comment:
       Thanks for the explanation. Would be great to fix this in a follow up 
issue. Not necessarily in this PR. Adding dependencies should always be avoided 
but I guess in this case it could make sense.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to