wuchong commented on a change in pull request #9029: [FLINK-13118][jdbc] 
Introduce JDBC table factory and bridge JDBC table source with streaming table 
source
URL: https://github.com/apache/flink/pull/9029#discussion_r302356136
 
 

 ##########
 File path: 
flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCTableSourceSinkFactory.java
 ##########
 @@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.api.java.io.jdbc;
+
+import org.apache.flink.api.java.io.jdbc.dialect.JDBCDialect;
+import org.apache.flink.api.java.io.jdbc.dialect.JDBCDialects;
+import org.apache.flink.api.java.tuple.Tuple2;
+import org.apache.flink.configuration.TimeLength;
+import org.apache.flink.table.api.TableSchema;
+import org.apache.flink.table.descriptors.DescriptorProperties;
+import org.apache.flink.table.descriptors.SchemaValidator;
+import org.apache.flink.table.factories.StreamTableSinkFactory;
+import org.apache.flink.table.factories.StreamTableSourceFactory;
+import org.apache.flink.table.sinks.StreamTableSink;
+import org.apache.flink.table.sources.StreamTableSource;
+import org.apache.flink.types.Row;
+import org.apache.flink.util.Preconditions;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import static 
org.apache.flink.table.descriptors.ConnectorDescriptorValidator.CONNECTOR_PROPERTY_VERSION;
+import static 
org.apache.flink.table.descriptors.ConnectorDescriptorValidator.CONNECTOR_TYPE;
+import static org.apache.flink.table.descriptors.Schema.SCHEMA;
+import static org.apache.flink.table.descriptors.Schema.SCHEMA_FROM;
+import static org.apache.flink.table.descriptors.Schema.SCHEMA_NAME;
+import static org.apache.flink.table.descriptors.Schema.SCHEMA_TYPE;
+
+/**
+ * Factory for creating configured instances of {@link JDBCTableSource} and 
{@link JDBCUpsertTableSink}.
+ */
+public class JDBCTableSourceSinkFactory implements
+       StreamTableSourceFactory<Row>,
+       StreamTableSinkFactory<Tuple2<Boolean, Row>> {
+
+       public static final String CONNECTOR_URL = "connector.url";
+       public static final String CONNECTOR_DBTABLE = "connector.dbtable";
+       public static final String CONNECTOR_DRIVER = "connector.driver";
+       public static final String CONNECTOR_USER = "connector.user";
+       public static final String CONNECTOR_PASSWORD = "connector.password";
+
+       public static final String CONNECTOR_SCAN_PARTITION_COLUMN = 
"connector.scan.partition-column";
+       public static final String CONNECTOR_SCAN_LOWER_BOUND = 
"connector.scan.lower-bound";
+       public static final String CONNECTOR_SCAN_UPPER_BOUND = 
"connector.scan.upper-bound";
+       public static final String CONNECTOR_SCAN_NUM_PARTITIONS = 
"connector.scan.num-partitions";
+
+       public static final String CONNECTOR_LOOKUP_CACHE_MAX_ENTRIES = 
"connector.lookup.cache.max-entries";
+       public static final String CONNECTOR_LOOKUP_CACHE_TTL = 
"connector.lookup.cache.ttl";
+       public static final String CONNECTOR_LOOKUP_MAX_RETRIES = 
"connector.lookup.max-retries";
+
+       public static final String CONNECTOR_WRITE_FLUSH_MAX_ENTRIES = 
"connector.write.flush.max-size";
+       public static final String CONNECTOR_WRITE_FLUSH_INTERVAL = 
"connector.write.flush.interval";
+       public static final String CONNECTOR_WRITE_MAX_RETRIES = 
"connector.write.max-retries";
 
 Review comment:
   Move all of them to `JDBCValidator` 

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


With regards,
Apache Git Services

Reply via email to