From 36948ae4d924ccecf8d9ffd9b9d997fc6370994c Mon Sep 17 00:00:00 2001 From: itsankit-google Date: Wed, 13 Mar 2024 15:11:26 +0000 Subject: [PATCH] Add information about no primary key spanner table --- docs/Spanner-batchsink.md | 4 ++++ .../io/cdap/plugin/gcp/spanner/sink/SpannerSinkConfig.java | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/Spanner-batchsink.md b/docs/Spanner-batchsink.md index b9b17d1350..c74c71e091 100644 --- a/docs/Spanner-batchsink.md +++ b/docs/Spanner-batchsink.md @@ -42,6 +42,10 @@ Each record is composed of columns (also called fields). Every table is defined by a schema that describes the column names, data types, and other information. If the table does not exist, it will get created. +**Note**: A table with no primary key columns can have only one row. +Only GoogleSQL-dialect databases can have tables without a primary key. +Please click [here](https://cloud.google.com/spanner/docs/schema-and-data-model) for more details. + **Primary Key**: If the table does not exist, a primary key must be provided in order to auto-create the table. The key can be a composite key of multiple fields in the schema. This is not required if the table already exists. diff --git a/src/main/java/io/cdap/plugin/gcp/spanner/sink/SpannerSinkConfig.java b/src/main/java/io/cdap/plugin/gcp/spanner/sink/SpannerSinkConfig.java index 5a6372e9e3..df788fdb37 100644 --- a/src/main/java/io/cdap/plugin/gcp/spanner/sink/SpannerSinkConfig.java +++ b/src/main/java/io/cdap/plugin/gcp/spanner/sink/SpannerSinkConfig.java @@ -55,7 +55,10 @@ public class SpannerSinkConfig extends PluginConfig { private static final String NAME_CMEK_KEY = "cmekKey"; @Name(NAME_TABLE) - @Description("Cloud Spanner table id. Uniquely identifies your table within the Cloud Spanner database") + @Description("Cloud Spanner table id. Uniquely identifies your table within the Cloud Spanner database." + + " Note: A table with no primary key columns can have only one row." + + " Only GoogleSQL-dialect databases can have tables without a primary key." + + " Please refer to https://cloud.google.com/spanner/docs/schema-and-data-model for more details.") @Macro private String table;