Samrat002 commented on code in PR #114: URL: https://github.com/apache/flink-connector-aws/pull/114#discussion_r1590270090
########## flink-connector-aws/flink-connector-redshift/src/main/java/org/apache/flink/connector/redshift/table/RedshiftDynamicTableFactory.java: ########## @@ -0,0 +1,213 @@ +/* + * 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.connector.redshift.table; + +import org.apache.flink.annotation.PublicEvolving; +import org.apache.flink.configuration.ConfigOption; +import org.apache.flink.configuration.ConfigOptions; +import org.apache.flink.configuration.ReadableConfig; +import org.apache.flink.connector.redshift.executor.RedshiftS3Util; +import org.apache.flink.connector.redshift.mode.SinkMode; +import org.apache.flink.connector.redshift.options.RedshiftOptions; +import org.apache.flink.table.catalog.ResolvedSchema; +import org.apache.flink.table.catalog.UniqueConstraint; +import org.apache.flink.table.connector.sink.DynamicTableSink; +import org.apache.flink.table.factories.DynamicTableSinkFactory; +import org.apache.flink.table.factories.FactoryUtil; +import org.apache.flink.table.types.DataType; + +import java.time.Duration; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Dynamic Table Factory. */ +@PublicEvolving +public class RedshiftDynamicTableFactory implements DynamicTableSinkFactory { + public static final String IDENTIFIER = "redshift"; + + public static final ConfigOption<String> HOSTNAME = + ConfigOptions.key("hostname") + .stringType() + .noDefaultValue() + .withDeprecatedKeys("AWS Redshift cluster hostname."); + + public static final ConfigOption<Integer> PORT = + ConfigOptions.key("port") + .intType() + .defaultValue(5439) + .withDeprecatedKeys("AWS Redshift port number.\nDefault value : 5439."); + + public static final ConfigOption<String> USERNAME = + ConfigOptions.key("username") + .stringType() + .noDefaultValue() + .withDescription("AWS Redshift Cluster username."); + + public static final ConfigOption<String> PASSWORD = + ConfigOptions.key("password") + .stringType() + .noDefaultValue() + .withDescription("AWS Redshift cluster password."); + + public static final ConfigOption<String> DATABASE_NAME = + ConfigOptions.key("sink.database-name") + .stringType() + .defaultValue("dev") + .withDescription( + "AWS Redshift cluster database name. Default value set to `dev`."); + + public static final ConfigOption<String> TABLE_NAME = + ConfigOptions.key("sink.table-name") + .stringType() + .noDefaultValue() + .withDescription("AWS Redshift cluster sink table name."); + + public static final ConfigOption<Integer> SINK_BATCH_SIZE = + ConfigOptions.key("sink.batch-size") + .intType() + .defaultValue(1000) + .withDescription( + "`sink.batch-size` determines the maximum size of batch, in terms of the number of records, " + + "at which data will trigger a flush operation." + + " When the number of records exceeds this threshold, the system initiates a flush to manage the data.\n" + + "Default Value: 1000"); + + public static final ConfigOption<Duration> SINK_FLUSH_INTERVAL = + ConfigOptions.key("sink.flush-interval") + .durationType() + .defaultValue(Duration.ofSeconds(1L)) + .withDescription( + "the flush interval mills, over this time, asynchronous threads will flush data. The default value is 1s."); + + public static final ConfigOption<Integer> SINK_MAX_RETRIES = + ConfigOptions.key("sink.max-retries") + .intType() + .defaultValue(3) + .withDescription("the max retry times if writing records to database failed."); + + public static final ConfigOption<SinkMode> SINK_MODE = + ConfigOptions.key("sink.mode") + .enumType(SinkMode.class) + .noDefaultValue() + .withDescription( + "Currently, 2 modes are supported for Flink connector redshift.\n" + + "\t 1) COPY Mode." + + "\t 2) JDBC Mode."); + public static final ConfigOption<String> TEMP_S3_URI = Review Comment: in copy mode , redhift data needs to be written into temporary s3 path. these path only useful till copy mode reads the data from temporary location (s3) and uploads to redhsift workers. In flip this config was mentioned -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org