wuchong commented on a change in pull request #11804:
URL: https://github.com/apache/flink/pull/11804#discussion_r411846216



##########
File path: docs/dev/table/catalogs.md
##########
@@ -37,6 +41,76 @@ Or permanent metadata, like that in a Hive Metastore. 
Catalogs provide a unified
 
 The `GenericInMemoryCatalog` is an in-memory implementation of a catalog. All 
objects will be available only for the lifetime of the session.
 
+### JDBCCatalog
+
+The `JDBCCatalog` enables users to connect Flink to relational databases over 
JDBC protocol.
+
+#### PostgresCatalog
+
+`PostgresCatalog` is the only implementation of JDBC Catalog at the moment.
+
+To set a `JDBCcatalog`,

Review comment:
       ```suggestion
   To set a `JDBCatalog`,
   ```

##########
File path: docs/dev/table/catalogs.md
##########
@@ -37,6 +41,76 @@ Or permanent metadata, like that in a Hive Metastore. 
Catalogs provide a unified
 
 The `GenericInMemoryCatalog` is an in-memory implementation of a catalog. All 
objects will be available only for the lifetime of the session.
 
+### JDBCCatalog
+
+The `JDBCCatalog` enables users to connect Flink to relational databases over 
JDBC protocol.
+
+#### PostgresCatalog
+
+`PostgresCatalog` is the only implementation of JDBC Catalog at the moment.
+
+To set a `JDBCcatalog`,
+
+<div class="codetabs" markdown="1">
+<div data-lang="Java" markdown="1">
+{% highlight java %}
+
+EnvironmentSettings settings = 
EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build();
+TableEnvironment tableEnv = TableEnvironment.create(settings);
+
+String name            = "mypg";
+String defaultDatabase = "mydb";
+String username        = "...";
+String password        = "...";
+String baseUrl         = "jdbc:postgresql://<ip>:<port>"; # should not contain 
database name here

Review comment:
       ```suggestion
   String baseUrl         = "jdbc:postgresql://<ip>:<port>"; // should not 
contain database name here
   ```

##########
File path: docs/dev/table/catalogs.md
##########
@@ -37,6 +41,76 @@ Or permanent metadata, like that in a Hive Metastore. 
Catalogs provide a unified
 
 The `GenericInMemoryCatalog` is an in-memory implementation of a catalog. All 
objects will be available only for the lifetime of the session.
 
+### JDBCCatalog
+
+The `JDBCCatalog` enables users to connect Flink to relational databases over 
JDBC protocol.
+
+#### PostgresCatalog
+
+`PostgresCatalog` is the only implementation of JDBC Catalog at the moment.
+
+To set a `JDBCcatalog`,
+
+<div class="codetabs" markdown="1">
+<div data-lang="Java" markdown="1">
+{% highlight java %}
+
+EnvironmentSettings settings = 
EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build();
+TableEnvironment tableEnv = TableEnvironment.create(settings);
+
+String name            = "mypg";
+String defaultDatabase = "mydb";
+String username        = "...";
+String password        = "...";
+String baseUrl         = "jdbc:postgresql://<ip>:<port>"; # should not contain 
database name here
+
+JDBCCatalog catalog = new JDBCCatalog(name, defaultDatabase, username, 
password, baseUrl);
+tableEnv.registerCatalog("mypg", catalog);
+
+// set the JDBCCatalog as the current catalog of the session
+tableEnv.useCatalog("mypg");
+{% endhighlight %}
+</div>
+<div data-lang="Scala" markdown="1">
+{% highlight scala %}
+
+val settings = 
EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build()
+val tableEnv = TableEnvironment.create(settings)
+
+val name            = "mypg";
+val defaultDatabase = "mydb";
+val username        = "...";
+val password        = "...";
+val baseUrl         = "jdbc:postgresql://<ip>:<port>"; # should not contain 
database name here
+
+val catalog = new JDBCCatalog(name, defaultDatabase, username, password, 
baseUrl);
+tableEnv.registerCatalog("mypg", catalog);
+
+// set the JDBCCatalog as the current catalog of the session
+tableEnv.useCatalog("mypg");
+{% endhighlight %}
+</div>
+<div data-lang="YAML" markdown="1">
+{% highlight yaml %}
+
+execution:
+    planner: blink
+    ...
+    current-catalog: mypg  # set the JDBCCatalog as the current catalog of the 
session
+    current-database: mydb
+    
+catalogs:
+   - name: mypg
+     type: jdbc
+     default-database: mydb
+     username: ...
+     password: ...
+     base-url: jdbc:postgresql://<ip>:<port>
+{% endhighlight %}

Review comment:
       Could you add some descriptions for the parameters? For example, what's 
meaning of the parameters, is it required or optional?

##########
File path: docs/dev/table/catalogs.md
##########
@@ -37,6 +41,76 @@ Or permanent metadata, like that in a Hive Metastore. 
Catalogs provide a unified
 
 The `GenericInMemoryCatalog` is an in-memory implementation of a catalog. All 
objects will be available only for the lifetime of the session.
 
+### JDBCCatalog
+
+The `JDBCCatalog` enables users to connect Flink to relational databases over 
JDBC protocol.
+
+#### PostgresCatalog
+
+`PostgresCatalog` is the only implementation of JDBC Catalog at the moment.
+
+To set a `JDBCcatalog`,
+
+<div class="codetabs" markdown="1">
+<div data-lang="Java" markdown="1">
+{% highlight java %}
+
+EnvironmentSettings settings = 
EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build();
+TableEnvironment tableEnv = TableEnvironment.create(settings);
+
+String name            = "mypg";
+String defaultDatabase = "mydb";
+String username        = "...";
+String password        = "...";
+String baseUrl         = "jdbc:postgresql://<ip>:<port>"; # should not contain 
database name here
+
+JDBCCatalog catalog = new JDBCCatalog(name, defaultDatabase, username, 
password, baseUrl);
+tableEnv.registerCatalog("mypg", catalog);
+
+// set the JDBCCatalog as the current catalog of the session
+tableEnv.useCatalog("mypg");
+{% endhighlight %}
+</div>
+<div data-lang="Scala" markdown="1">
+{% highlight scala %}
+
+val settings = 
EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build()
+val tableEnv = TableEnvironment.create(settings)
+
+val name            = "mypg";
+val defaultDatabase = "mydb";
+val username        = "...";
+val password        = "...";
+val baseUrl         = "jdbc:postgresql://<ip>:<port>"; # should not contain 
database name here

Review comment:
       ```suggestion
   val baseUrl         = "jdbc:postgresql://<ip>:<port>"; // should not contain 
database name here
   ```

##########
File path: docs/dev/table/catalogs.md
##########
@@ -37,6 +41,76 @@ Or permanent metadata, like that in a Hive Metastore. 
Catalogs provide a unified
 
 The `GenericInMemoryCatalog` is an in-memory implementation of a catalog. All 
objects will be available only for the lifetime of the session.
 
+### JDBCCatalog
+
+The `JDBCCatalog` enables users to connect Flink to relational databases over 
JDBC protocol.
+
+#### PostgresCatalog
+
+`PostgresCatalog` is the only implementation of JDBC Catalog at the moment.
+
+To set a `JDBCcatalog`,
+
+<div class="codetabs" markdown="1">
+<div data-lang="Java" markdown="1">
+{% highlight java %}
+
+EnvironmentSettings settings = 
EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build();
+TableEnvironment tableEnv = TableEnvironment.create(settings);
+
+String name            = "mypg";
+String defaultDatabase = "mydb";
+String username        = "...";
+String password        = "...";
+String baseUrl         = "jdbc:postgresql://<ip>:<port>"; # should not contain 
database name here
+
+JDBCCatalog catalog = new JDBCCatalog(name, defaultDatabase, username, 
password, baseUrl);
+tableEnv.registerCatalog("mypg", catalog);
+
+// set the JDBCCatalog as the current catalog of the session
+tableEnv.useCatalog("mypg");
+{% endhighlight %}
+</div>
+<div data-lang="Scala" markdown="1">
+{% highlight scala %}
+
+val settings = 
EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build()
+val tableEnv = TableEnvironment.create(settings)
+
+val name            = "mypg";
+val defaultDatabase = "mydb";
+val username        = "...";
+val password        = "...";
+val baseUrl         = "jdbc:postgresql://<ip>:<port>"; # should not contain 
database name here
+
+val catalog = new JDBCCatalog(name, defaultDatabase, username, password, 
baseUrl);
+tableEnv.registerCatalog("mypg", catalog);
+
+// set the JDBCCatalog as the current catalog of the session
+tableEnv.useCatalog("mypg");
+{% endhighlight %}
+</div>
+<div data-lang="YAML" markdown="1">

Review comment:
       Do we support to use DDL to create a catalog? IIRC, we support syntax 
`CREATE CATALOG xxx WITH (...)`.

##########
File path: docs/dev/table/catalogs.md
##########
@@ -37,6 +41,76 @@ Or permanent metadata, like that in a Hive Metastore. 
Catalogs provide a unified
 
 The `GenericInMemoryCatalog` is an in-memory implementation of a catalog. All 
objects will be available only for the lifetime of the session.
 
+### JDBCCatalog
+
+The `JDBCCatalog` enables users to connect Flink to relational databases over 
JDBC protocol.
+
+#### PostgresCatalog
+
+`PostgresCatalog` is the only implementation of JDBC Catalog at the moment.
+
+To set a `JDBCcatalog`,
+
+<div class="codetabs" markdown="1">
+<div data-lang="Java" markdown="1">
+{% highlight java %}
+
+EnvironmentSettings settings = 
EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build();
+TableEnvironment tableEnv = TableEnvironment.create(settings);
+
+String name            = "mypg";
+String defaultDatabase = "mydb";
+String username        = "...";
+String password        = "...";
+String baseUrl         = "jdbc:postgresql://<ip>:<port>"; # should not contain 
database name here
+
+JDBCCatalog catalog = new JDBCCatalog(name, defaultDatabase, username, 
password, baseUrl);
+tableEnv.registerCatalog("mypg", catalog);
+
+// set the JDBCCatalog as the current catalog of the session
+tableEnv.useCatalog("mypg");
+{% endhighlight %}
+</div>
+<div data-lang="Scala" markdown="1">
+{% highlight scala %}
+
+val settings = 
EnvironmentSettings.newInstance().useBlinkPlanner().inStreamingMode().build()
+val tableEnv = TableEnvironment.create(settings)
+
+val name            = "mypg";
+val defaultDatabase = "mydb";
+val username        = "...";
+val password        = "...";
+val baseUrl         = "jdbc:postgresql://<ip>:<port>"; # should not contain 
database name here
+
+val catalog = new JDBCCatalog(name, defaultDatabase, username, password, 
baseUrl);
+tableEnv.registerCatalog("mypg", catalog);
+
+// set the JDBCCatalog as the current catalog of the session
+tableEnv.useCatalog("mypg");

Review comment:
       Remove `;` for Scala codes.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to