Skip to content

Commit ee559a4

Browse files
authored
tweak snowflake destination to hide INSERT load method (#9982)
* tweak snowflake to hide INSERT load method * address review comment
1 parent 8410b17 commit ee559a4

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

airbyte-integrations/connectors/destination-snowflake/src/main/java/io/airbyte/integrations/destination/snowflake/SnowflakeDestination.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public class SnowflakeDestination extends SwitchingDestination<SnowflakeDestinat
1818
private static final Logger LOGGER = LoggerFactory.getLogger(SnowflakeDestination.class);
1919

2020
enum DestinationType {
21-
INSERT,
2221
COPY_S3,
2322
COPY_GCS,
2423
INTERNAL_STAGING
@@ -28,7 +27,7 @@ public SnowflakeDestination() {
2827
super(DestinationType.class, SnowflakeDestination::getTypeFromConfig, getTypeToDestination());
2928
}
3029

31-
public static DestinationType getTypeFromConfig(final JsonNode config) {
30+
private static DestinationType getTypeFromConfig(final JsonNode config) {
3231
if (isS3Copy(config)) {
3332
return DestinationType.COPY_S3;
3433
} else if (isGcsCopy(config)) {
@@ -38,11 +37,6 @@ public static DestinationType getTypeFromConfig(final JsonNode config) {
3837
}
3938
}
4039

41-
public static boolean isInternalStaging(final JsonNode config) {
42-
return config.has("loading_method") && config.get("loading_method").isObject()
43-
&& config.get("loading_method").get("method").asText().equals("Internal Staging");
44-
}
45-
4640
public static boolean isS3Copy(final JsonNode config) {
4741
return config.has("loading_method") && config.get("loading_method").isObject() && config.get("loading_method").has("s3_bucket_name");
4842
}
@@ -51,14 +45,12 @@ public static boolean isGcsCopy(final JsonNode config) {
5145
return config.has("loading_method") && config.get("loading_method").isObject() && config.get("loading_method").has("project_id");
5246
}
5347

54-
public static Map<DestinationType, Destination> getTypeToDestination() {
55-
final SnowflakeInsertDestination insertDestination = new SnowflakeInsertDestination();
48+
private static Map<DestinationType, Destination> getTypeToDestination() {
5649
final SnowflakeCopyS3Destination copyS3Destination = new SnowflakeCopyS3Destination();
5750
final SnowflakeCopyGcsDestination copyGcsDestination = new SnowflakeCopyGcsDestination();
5851
final SnowflakeInternalStagingDestination internalStagingDestination = new SnowflakeInternalStagingDestination();
5952

6053
return ImmutableMap.of(
61-
DestinationType.INSERT, insertDestination,
6254
DestinationType.COPY_S3, copyS3Destination,
6355
DestinationType.COPY_GCS, copyGcsDestination,
6456
DestinationType.INTERNAL_STAGING, internalStagingDestination);

airbyte-integrations/connectors/destination-snowflake/src/main/resources/spec.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,28 @@
8181
"order": 8,
8282
"oneOf": [
8383
{
84-
"title": "[Recommended] Internal Staging",
84+
"title": "Select another option",
8585
"additionalProperties": false,
86-
"description": "Writes large batches of records to a file, uploads the file to Snowflake, then uses <pre>COPY INTO table</pre> to upload the file. Recommended for large production workloads for better speed and scalability.",
86+
"description": "Select another option",
8787
"required": ["method"],
8888
"properties": {
8989
"method": {
9090
"type": "string",
91-
"enum": ["Internal Staging"],
92-
"default": "Internal Staging"
91+
"enum": ["Standard"],
92+
"default": "Standard"
9393
}
9494
}
9595
},
9696
{
97-
"title": "Standard Inserts",
97+
"title": "[Recommended] Internal Staging",
9898
"additionalProperties": false,
99-
"description": "Uses <pre>INSERT</pre> statements to send batches of records to Snowflake. Easiest (no setup) but not recommended for large production workloads due to slow speed.",
99+
"description": "Writes large batches of records to a file, uploads the file to Snowflake, then uses <pre>COPY INTO table</pre> to upload the file. Recommended for large production workloads for better speed and scalability.",
100100
"required": ["method"],
101101
"properties": {
102102
"method": {
103103
"type": "string",
104-
"enum": ["Standard"],
105-
"default": "Standard"
104+
"enum": ["Internal Staging"],
105+
"default": "Internal Staging"
106106
}
107107
}
108108
},

0 commit comments

Comments
 (0)