Migrate from Kafka connector v3 to v4¶
This topic describes how to migrate from the classic Kafka connector (v3 and earlier) to the Snowflake Connector for Kafka (v4).
Overview¶
The Snowflake Connector for Kafka (v4) is a ground-up rewrite that exclusively uses Snowpipe Streaming high-performance architecture. You must create a new connector configuration manually to migrate to v4.
Important
The v4 connector can’t be used as a drop-in replacement for v3. It uses a different connector class, different default behaviors, and a different feature set. Review the breaking changes and migration paths below before migrating.
Pricing changes¶
The v4 connector uses flat, throughput-based pricing based on the volume of data ingested (GB). This is the same pricing model as Snowpipe Streaming high-performance architecture. To estimate costs, multiply your data ingestion rate by the per-GB price listed on the Snowpipe Streaming cost page.
This replaces the v3 pricing model, which was based on serverless compute and file notifications.
Compatibility validation¶
By default, v4 enables a startup compatibility check
(snowflake.streaming.validate.compatibility.with.classic=true) that prevents you from
accidentally running v4 with a copied v3 configuration. When enabled, the connector validates
at startup that you’ve explicitly configured the key migration settings. If any are missing or
incompatible, the connector fails with a descriptive error message telling you exactly what
to set.
The validator checks the following:
snowflake.validationis set toclient_sidesnowflake.compatibility.enable.column.identifier.normalizationis set totruesnowflake.compatibility.enable.autogenerated.table.name.sanitizationis set totruesnowflake.enable.schematizationis explicitly set totrueorfalse(the default changed fromfalsein v3 totruein v4, so the validator requires you to confirm your choice)snowflake.streaming.classic.offset.migrationis explicitly setsnowflake.streaming.classic.offset.migration.include.connector.nameis explicitly set (when offset migration isstrictorbest_effort)
After you’ve reviewed the breaking changes and explicitly configured these settings,
you can set snowflake.streaming.validate.compatibility.with.classic=false to skip the
check on subsequent restarts.
For full descriptions of these properties, see Schematization, validation, and compatibility properties and Offset migration properties.
Important
Start with snowflake.validation=server_side, the default for standard Snowflake and Snowflake-managed Iceberg tables. This includes standard-table pipelines that don’t need schema evolution. Choose client_side for a compatible target schema when you need connector-side type mapping for new columns or client-detected validation errors routed to a Kafka dead-letter queue. Avro or Protobuf records alone don’t require client_side. For the pre-created Iceberg v3 path, see Client-side schema evolution for Iceberg.
Pre-create columns when you need exact types or precision in either mode. Server-side evolution infers new-column types from values; client-side evolution can use a converter-provided schema, but its mappings don’t preserve every declared type. For example, Kafka Connect logical decimal fields map to VARCHAR. After reviewing the migration settings above, set snowflake.streaming.validate.compatibility.with.classic=false before starting a server-side configuration. For details, see Choose a validation mode and Iceberg limitations.
Migration paths¶
The migration path depends on how your v3 connector was configured.
Before migrating, ensure that snowflake.metadata.topic, snowflake.metadata.offset.and.partition,
and snowflake.metadata.createtime are enabled in your v3 connector (they’re on by default). This
ensures that RECORD_METADATA contains the topic, partition, and offset fields needed for
deduplication if any issues arise.
Keep the v3 connector name¶
Give the v4 connector the same name as the v3 connector. The name determines the Kafka consumer group
(connect-<connector_name> by default) that holds the committed offsets. Kafka Connect allows only one
connector per name, even a stopped one, so creating a second connector with that name returns
409 Conflict. Replace the v3 connector instead:
-
Save your v3 configuration so that you can roll back:
-
Stop or remove the v3 connector:
-
Distributed mode, Apache Kafka 3.5 or later: stop the connector.
-
Distributed mode, earlier Kafka versions: delete the connector. Deleting a connector doesn’t delete its consumer group offsets.
-
Standalone mode: stop the worker.
-
-
Wait for the v3 connector to finish. Kafka Connect returns from stop and delete before the v3 tasks finish writing. Run the following command until
STATEisEmpty:If the worker log shows
consumer poll timeout has expiredfor this connector, v3 was still writing when the group became empty, and you might see duplicate records. If you’re migrating from Snowpipe mode, also wait for all staged data to be ingested. -
Start the v4 connector with the same name:
-
Distributed mode, Apache Kafka 3.5 or later: replace the configuration, then resume the connector. The request body is the complete v4 configuration as a flat JSON object, without the
nameandconfigwrapper thatPOST /connectorsuses. It replaces the whole configuration. -
Distributed mode, earlier Kafka versions: create the connector with
POST /connectorsand the samename. -
Standalone mode: start the worker with the v4 properties file and the same
name.
-
-
After new records arrive, check that the connector and its tasks are
RUNNING:v4 checks its migration settings when it starts, not when you submit the configuration. A missing or incorrect setting shows up here as
FAILED.
To roll back, repeat these steps with v3-config.json.
Migrating from v3 Snowpipe mode¶
If your v3 connector was using classic Snowpipe (the default snowflake.ingestion.method=SNOWPIPE),
v4 migrates seamlessly using Kafka consumer group offsets.
Warning
Make sure that the v3 connector stops gracefully. Kafka Connect waits up to
task.shutdown.graceful.timeout.ms (a worker setting, 5 seconds by default) for a task to stop. If the
task takes longer, Kafka Connect abandons it and skips its final offset commit, and v4 loads those
records again. Before you migrate, raise task.shutdown.graceful.timeout.ms in the worker
configuration and restart the workers. Setting it in the connector configuration has no effect.
-
Stop the v3 connector.
-
Wait for all staged data to be ingested into Snowflake. Classic Snowpipe stages files before loading them, and any files still in the queue when you stop the connector will be loaded asynchronously. Starting the v4 connector before this completes may cause data to land out of order.
-
Deploy the new v4 configuration using the same connector name as v3 (same Kafka consumer group). For more information, see Keep the v3 connector name. Set the offset migration config to skip SSv1 migration:
-
Start the v4 connector. It inherits the Kafka consumer group offsets and resumes ingestion where v3 left off.
Complete the switchover within offsets.retention.minutes (default 7 days) to avoid offset expiration.
This migration path doesn’t introduce duplicates or gaps.
Migrating from v3 Snowpipe Streaming mode¶
If your v3 connector was using Snowpipe Streaming
(snowflake.ingestion.method=SNOWPIPE_STREAMING), v4 can automatically migrate the committed
offsets from the v3 Snowpipe Streaming (SSv1) channels. This prevents duplicates or gaps.
-
Stop the v3 connector.
-
Deploy the new v4 configuration using the same connector name as v3. For more information, see Keep the v3 connector name. Configure the offset migration settings:
-
Start the v4 connector. It recovers the committed offsets from the existing SSv1 channels and resumes ingestion where v3 left off.
Complete the switchover within offsets.retention.minutes (default 7 days).
Downgrading from v4 to v3¶
Downgrading from v4 back to v3 is possible by reversing the migration process. However, duplicate records are expected after a downgrade because v3 and v4 track offsets differently.
To downgrade:
- Stop the v4 connector.
- Deploy your v3 configuration using the same connector name. For more information, see Keep the v3 connector name.
- Start the v3 connector.
- After the downgrade, deduplicate your data using the
RECORD_METADATAcolumn. The following query keeps one copy of each record and leaves rows withoutRECORD_METADATAunchanged.INSERT OVERWRITErewrites the whole table, so stop the connector while the query runs:
Important
Deduplication requires that RECORD_METADATA contains topic, partition, and offset fields.
Ensure the snowflake.metadata.topic and snowflake.metadata.offset.and.partition settings
are enabled before migrating to v4.
If you encounter issues during the downgrade, contact Snowflake Support.
Breaking changes¶
New connector class¶
| Change | v3 | v4 |
|---|---|---|
| Connector class | com.snowflake.kafka.connector.SnowflakeSinkConnector | com.snowflake.kafka.connector.SnowflakeStreamingSinkConnector |
| Ingestion method | Snowpipe (batch) or Snowpipe Streaming (optional) | Snowpipe Streaming only |
| Java version | Java 8+ | Java 11+ |
Changed default behaviors¶
| Configuration | v3 default | v4 default |
|---|---|---|
snowflake.enable.schematization | false (records stored in RECORD_CONTENT and RECORD_METADATA VARIANT columns) | true (record fields mapped to individual table columns) |
snowflake.validation | Client-side equivalent | server_side (validation performed by Snowflake backend) |
snowflake.compatibility.enable.autogenerated.table.name.sanitization | true equivalent (invalid characters replaced, names uppercased) | false (topic names used as-is for table names, preserving case and special characters) |
snowflake.compatibility.enable.column.identifier.normalization | true equivalent (column names uppercased) | false (column identifiers preserve case) |
Note
The v4 connector uses only the high-performance architecture. After you upgrade, the SNOWPIPE_STREAMING_CHANNEL_HISTORY view records history only for channels that encounter ingestion errors, so it can be empty while ingestion succeeds. To monitor successful ingestion, use the channel status API. For details, see .
Removed configurations¶
The following configuration properties from v3 aren’t accepted in v4:
snowflake.ingestion.method(v4 exclusively uses Snowpipe Streaming)buffer.flush.time,buffer.size.bytes,buffer.count.records(managed by the Snowpipe Streaming SDK)snowflake.streaming.max.client.lag(managed by the SDK)snowflake.streaming.enable.single.buffersnowflake.streaming.max.memory.limit.bytessnowflake.streaming.closeChannelsInParallel.enabled(always parallel in v4)snowflake.streaming.iceberg.enabled(auto-detected in v4)snowflake.snowpipe.*(Snowpipe non-streaming not supported)enable.streaming.client.optimizationenable.streaming.channel.offset.migration(v3 internal channel name format migration, not needed in v4)snowflake.streaming.channel.name.include.connector.nameenable.streaming.channel.offset.verificationsnowflake.oauth.*(v3 OAuth property names not used in v4; see Authentication for v4 OAuth support)provider
Removed custom converters¶
The following Snowflake-provided custom converters aren’t available in v4:
com.snowflake.kafka.connector.records.SnowflakeJsonConvertercom.snowflake.kafka.connector.records.SnowflakeAvroConvertercom.snowflake.kafka.connector.records.SnowflakeAvroConverterWithoutSchemaRegistry
Use standard community converters instead:
org.apache.kafka.connect.json.JsonConverterio.confluent.connect.avro.AvroConverterio.confluent.connect.protobuf.ProtobufConverter
Changed values in RECORD_ CONTENT¶
If you set snowflake.enable.schematization to false, v4 stores some values in the RECORD_CONTENT column in a different format than v3. Ingestion isn’t affected, but queries, views, and streams that read these values can return errors or NULL. Before you migrate, update any SQL that reads the following values:
| Value | v3 format | v4 format | How to update your SQL |
|---|---|---|---|
Timestamps (Kafka Connect Timestamp logical type, such as Avro timestamp-millis) | Epoch milliseconds as a string, such as "1705312800000" | ISO 8601 string, such as "2024-01-15T10:00:00.000Z" | Cast the value directly, such as RECORD_CONTENT:event_time::TIMESTAMP_NTZ. A v3 expression such as TO_TIMESTAMP(RECORD_CONTENT:event_time::NUMBER, 3) returns an error for v4 values. |
Times (Kafka Connect Time logical type, such as Avro time-millis) | Snowpipe mode: "10:30:00.000+0000". Snowpipe Streaming mode: "10:30:00.000Z". | "10:30:00.000Z" | If you migrate from Snowpipe mode, update string comparisons and formats that expect +0000. |
| Floating-point infinity | "Infinity" and "-Infinity" | "Inf" and "-Inf" | Update filters that match these strings. |
Warning
If you use org.apache.kafka.connect.json.JsonConverter with value.converter.schemas.enable=false, integer values outside the 64-bit signed range (-9223372036854775808 to 9223372036854775807) aren’t stored correctly, and no error is reported. The v3 SnowflakeJsonConverter stored these values correctly. To keep these values, send them as JSON strings.
Authentication¶
v4.0 supports key-pair authentication only. Starting with v4.1.0, the connector also supports OAuth, and starting with v4.2.0 it supports workload-identity (SPCS) authentication. If you used OAuth with v3, you must use key-pair authentication when initially migrating to v4.0; you can switch to OAuth after upgrading to v4.1.0 or later, or to SPCS authentication after upgrading to v4.2.0 or later. For details, see Authentication.
Migration steps¶
-
Review breaking changes: Review the breaking changes above and determine how they affect your current deployment.
-
Verify metadata settings: Before migrating, confirm that
snowflake.metadata.topicandsnowflake.metadata.offset.and.partitionare enabled in your v3 connector (they’re on by default). This ensures deduplication is possible if needed. -
Create a new connector configuration: Create a new configuration file using the
SnowflakeStreamingSinkConnectorclass. You can’t copy your v3 configuration directly because v4 has different defaults for schematization, validation, and identifier handling. See Snowflake Connector for Kafka: Install and configure for the full configuration reference. -
Configure compatibility and offset migration settings: The v4 connector validates these settings at startup. You must explicitly set the following:
snowflake.enable.schematization: Set totrue(new v4 behavior) orfalse(v3 behavior).snowflake.validation: Set toclient_sidefor v3 compatibility orserver_sidefor v4 defaults.snowflake.compatibility.enable.autogenerated.table.name.sanitization: Set totruefor v3 compatibility.snowflake.compatibility.enable.column.identifier.normalization: Set totruefor v3 compatibility.snowflake.streaming.classic.offset.migration: Set toskipif migrating from Snowpipe mode, orbest_effort/strictif migrating from Snowpipe Streaming mode.
For more information, see Compatibility validation.
-
Replace custom converters: If you use Snowflake-provided converters, replace them with the community equivalents listed above.
-
Follow the migration path for your ingestion mode: See Migrating from Snowpipe mode or Migrating from Snowpipe Streaming mode above.
-
Test with sample data: Deploy the new connector configuration against a test environment and verify that data flows correctly before migrating production workloads.
-
Adopt v4 defaults incrementally: Once your migration is validated, consider incrementally adopting v4 defaults (server-side validation, case-sensitive identifiers) for improved performance and alignment with Snowflake conventions.
Recommended migration configurations¶
Migrating from v3 Snowpipe mode (v3 compatible)¶
The following configuration reproduces v3 behavior while running on the v4 connector, for users migrating from classic Snowpipe:
Migrating from v3 Snowpipe Streaming mode (v3 compatible)¶
The following configuration reproduces v3 behavior and migrates offsets from v3 Snowpipe Streaming (SSv1) channels: