turcsanyip commented on a change in pull request #3394: NIFI-6159 - Add 
BigQuery processor using the Streaming API
URL: https://github.com/apache/nifi/pull/3394#discussion_r278312517
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/bigquery/PutBigQueryStreaming.java
 ##########
 @@ -0,0 +1,163 @@
+/*
+ * 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.gcp.bigquery;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.nifi.annotation.behavior.InputRequirement;
+import org.apache.nifi.annotation.behavior.SystemResource;
+import org.apache.nifi.annotation.behavior.SystemResourceConsideration;
+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.annotation.lifecycle.OnScheduled;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.flowfile.FlowFile;
+import org.apache.nifi.logging.LogLevel;
+import org.apache.nifi.processor.ProcessContext;
+import org.apache.nifi.processor.ProcessSession;
+import org.apache.nifi.processor.exception.ProcessException;
+import org.apache.nifi.serialization.RecordReader;
+import org.apache.nifi.serialization.RecordReaderFactory;
+import org.apache.nifi.serialization.record.MapRecord;
+import org.apache.nifi.serialization.record.Record;
+import org.apache.nifi.util.StringUtils;
+
+import com.google.cloud.bigquery.BigQueryError;
+import com.google.cloud.bigquery.InsertAllRequest;
+import com.google.cloud.bigquery.InsertAllResponse;
+import com.google.cloud.bigquery.TableId;
+import com.google.common.collect.ImmutableList;
+
+/**
+ * A processor for streaming loading data into a Google BigQuery table. It 
uses the BigQuery
+ * streaming insert API to insert data. This provides the lowest-latency 
insert path into BigQuery,
+ * and therefore is the default method when the input is unbounded. BigQuery 
will make a strong
+ * effort to ensure no duplicates when using this path, however there are some 
scenarios in which
+ * BigQuery is unable to make this guarantee (see
+ * https://cloud.google.com/bigquery/streaming-data-into-bigquery). A query 
can be run over the
+ * output table to periodically clean these rare duplicates. Alternatively, 
using the Batch insert
+ * method does guarantee no duplicates, though the latency for the insert into 
BigQuery will be much
+ * higher.
+ */
+@InputRequirement(InputRequirement.Requirement.INPUT_REQUIRED)
+@Tags({ "google", "google cloud", "bq", "gcp", "bigquery", "record" })
+@CapabilityDescription("Load data into Google BigQuery table using the 
streaming API. This processor "
+        + "is not intended to load large flow files as it will load the full 
content into memory. If "
+        + "you need to insert large flow files, consider using 
PutBigQueryBatch instead.")
+@SeeAlso({ PutBigQueryBatch.class })
+@SystemResourceConsideration(resource = SystemResource.MEMORY)
+public class PutBigQueryStreaming extends AbstractBigQueryProcessor {
+
+    public static final PropertyDescriptor RECORD_READER = new 
PropertyDescriptor.Builder()
+            .name("put-bigquery-streaming-record-reader")
 
 Review comment:
   Please follow the convention used in AbstractBigQueryProcessor / 
PutBigQueryBatch:
   - property names are defined in BigQueryAttributes
   - the name is dot separated instead of dash

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to