dam4rus commented on code in PR #6584: URL: https://github.com/apache/nifi/pull/6584#discussion_r1021256108
########## nifi-nar-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/PutSnowflakeInternalStage.java: ########## @@ -0,0 +1,148 @@ +/* + * 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.nifi.processors.snowflake; + +import static org.apache.nifi.processors.snowflake.common.Attributes.ATTRIBUTE_STAGED_FILE_PATH; + +import java.io.IOException; +import java.io.InputStream; +import java.sql.SQLException; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.apache.nifi.annotation.behavior.InputRequirement; +import org.apache.nifi.annotation.behavior.InputRequirement.Requirement; +import org.apache.nifi.annotation.behavior.ReadsAttribute; +import org.apache.nifi.annotation.behavior.ReadsAttributes; +import org.apache.nifi.annotation.behavior.WritesAttribute; +import org.apache.nifi.annotation.behavior.WritesAttributes; +import org.apache.nifi.annotation.documentation.CapabilityDescription; +import org.apache.nifi.annotation.documentation.SeeAlso; +import org.apache.nifi.annotation.documentation.Tags; +import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.expression.ExpressionLanguageScope; +import org.apache.nifi.flowfile.FlowFile; +import org.apache.nifi.flowfile.attributes.CoreAttributes; +import org.apache.nifi.processor.AbstractProcessor; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.ProcessSession; +import org.apache.nifi.processor.Relationship; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.processor.util.StandardValidators; + +@InputRequirement(Requirement.INPUT_REQUIRED) +@ReadsAttributes({ + @ReadsAttribute(attribute = "filename", description = "The name of the staged file in the internal stage"), + @ReadsAttribute(attribute = "path", description = "The relative path to the staged file in the internal stage") +}) +@WritesAttributes({ + @WritesAttribute(attribute = ATTRIBUTE_STAGED_FILE_PATH, + description = "Staged file path") +}) +@Tags({"snowflake", "jdbc", "database", "connection"}) +@CapabilityDescription("Puts files into a Snowflake internal stage. The internal stage must be created in the Snowflake account beforehand." + + " This processor can be connected to an StartSnowflakeIngest processor to ingest the file in the internal stage") +@SeeAlso({StartSnowflakeIngest.class, GetSnowflakeIngestStatus.class}) +public class PutSnowflakeInternalStage extends AbstractProcessor { + + static final PropertyDescriptor SNOWFLAKE_CONNECTION_PROVIDER = new PropertyDescriptor.Builder() + .name("snowflake-connection-provider") + .displayName("Snowflake Connection Provider") + .description("Specifies the Controller Service to use for creating SQL connections to Snowflake.") + .identifiesControllerService(SnowflakeConnectionProviderService.class) + .required(true) + .build(); + + static final PropertyDescriptor INTERNAL_STAGE_NAME = new PropertyDescriptor.Builder() + .name("internal-stage-name") + .displayName("Internal Stage Name") + .description("The name of the internal stage in the Snowflake account to put files into.") + .addValidator(StandardValidators.NON_BLANK_VALIDATOR) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) + .required(true) + .build(); Review Comment: This isn't exactly true in this case. If `database` and `schema` is set in the `SnowflakeComputingConnectionPool` then the fully qualified name isn't required, since this processor uses a connection from that pool. I can still add the properties to enable setting/overriding the properties here though but it's kinda redundant. -- 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]
