Skip to content

Commit 48dba70

Browse files
committed
snowflake-merge-stmt
1 parent cba3ccd commit 48dba70

File tree

5 files changed

+2169
-123
lines changed

5 files changed

+2169
-123
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ constructor(
201201
getRetentionPeriodDays(
202202
config[RETENTION_PERIOD_DAYS],
203203
)
204-
val sqlGenerator = SnowflakeSqlGenerator(retentionPeriodDays)
204+
val useMergeForUpsert =
205+
config.has(USE_MERGE_FOR_UPSERT) && config[USE_MERGE_FOR_UPSERT].asBoolean(false)
206+
val sqlGenerator = SnowflakeSqlGenerator(retentionPeriodDays, useMergeForUpsert)
205207
val database = getDatabase(getDataSource(config))
206208
val databaseName = config[JdbcUtils.DATABASE_KEY].asText()
207209
val rawTableSchemaName: String =
@@ -285,6 +287,7 @@ constructor(
285287
const val RAW_SCHEMA_OVERRIDE: String = "raw_data_schema"
286288
const val RETENTION_PERIOD_DAYS: String = "retention_period_days"
287289
const val DISABLE_TYPE_DEDUPE: String = "disable_type_dedupe"
290+
const val USE_MERGE_FOR_UPSERT: String = "use_merge_for_upsert"
288291
@JvmField
289292
val SCHEDULED_EXECUTOR_SERVICE: ScheduledExecutorService =
290293
Executors.newScheduledThreadPool(1)

0 commit comments

Comments
 (0)