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.validation is set to client_side
  • snowflake.compatibility.enable.column.identifier.normalization is set to true
  • snowflake.compatibility.enable.autogenerated.table.name.sanitization is set to true
  • snowflake.enable.schematization is explicitly set to true or false (the default changed from false in v3 to true in v4, so the validator requires you to confirm your choice)
  • snowflake.streaming.classic.offset.migration is explicitly set
  • snowflake.streaming.classic.offset.migration.include.connector.name is explicitly set (when offset migration is strict or best_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:

  1. Save your v3 configuration so that you can roll back:

    curl http://localhost:8083/connectors/<connector_name>/config > v3-config.json
    
  2. Stop or remove the v3 connector:

    • Distributed mode, Apache Kafka 3.5 or later: stop the connector.

      curl -X PUT http://localhost:8083/connectors/<connector_name>/stop
      
    • Distributed mode, earlier Kafka versions: delete the connector. Deleting a connector doesn’t delete its consumer group offsets.

      curl -X DELETE http://localhost:8083/connectors/<connector_name>
      
    • Standalone mode: stop the worker.

  3. 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 STATE is Empty:

    kafka-consumer-groups --bootstrap-server <broker> --describe --group connect-<connector_name> --state
    

    If the worker log shows consumer poll timeout has expired for 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.

  4. 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 name and config wrapper that POST /connectors uses. It replaces the whole configuration.

      curl -X PUT -H "Content-Type: application/json" --data @v4-config.json http://localhost:8083/connectors/<connector_name>/config
      curl -X PUT http://localhost:8083/connectors/<connector_name>/resume
      
    • Distributed mode, earlier Kafka versions: create the connector with POST /connectors and the same name.

    • Standalone mode: start the worker with the v4 properties file and the same name.

  5. After new records arrive, check that the connector and its tasks are RUNNING:

    curl http://localhost:8083/connectors/<connector_name>/status
    

    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.

  1. Stop the v3 connector.

  2. 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.

  3. 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:

    snowflake.streaming.classic.offset.migration=skip
    
  4. 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.

  1. Stop the v3 connector.

  2. 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:

    # Use 'strict' to fail if SSv1 channels aren't found, or 'best_effort' to fall
    # back to Kafka consumer group offsets if channels aren't found.
    snowflake.streaming.classic.offset.migration=best_effort
    
    # Must match your v3 setting for snowflake.streaming.channel.name.include.connector.name.
    # Set to 'true' if your v3 connector included the connector name in channel names.
    snowflake.streaming.classic.offset.migration.include.connector.name=false
    
  3. 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:

  1. Stop the v4 connector.
  2. Deploy your v3 configuration using the same connector name. For more information, see Keep the v3 connector name.
  3. Start the v3 connector.
  4. After the downgrade, deduplicate your data using the RECORD_METADATA column. The following query keeps one copy of each record and leaves rows without RECORD_METADATA unchanged. INSERT OVERWRITE rewrites the whole table, so stop the connector while the query runs:
    INSERT OVERWRITE INTO my_table
    SELECT * FROM my_table
    QUALIFY RECORD_METADATA IS NULL
      OR ROW_NUMBER() OVER (
           PARTITION BY RECORD_METADATA:topic, RECORD_METADATA:partition, RECORD_METADATA:offset
           ORDER BY RECORD_METADATA:offset
         ) = 1;
    

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

Changev3v4
Connector classcom.snowflake.kafka.connector.SnowflakeSinkConnectorcom.snowflake.kafka.connector.SnowflakeStreamingSinkConnector
Ingestion methodSnowpipe (batch) or Snowpipe Streaming (optional)Snowpipe Streaming only
Java versionJava 8+Java 11+

Changed default behaviors

Configurationv3 defaultv4 default
snowflake.enable.schematizationfalse (records stored in RECORD_CONTENT and RECORD_METADATA VARIANT columns)true (record fields mapped to individual table columns)
snowflake.validationClient-side equivalentserver_side (validation performed by Snowflake backend)
snowflake.compatibility.enable.autogenerated.table.name.sanitizationtrue 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.normalizationtrue 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.buffer
  • snowflake.streaming.max.memory.limit.bytes
  • snowflake.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.optimization
  • enable.streaming.channel.offset.migration (v3 internal channel name format migration, not needed in v4)
  • snowflake.streaming.channel.name.include.connector.name
  • enable.streaming.channel.offset.verification
  • snowflake.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.SnowflakeJsonConverter
  • com.snowflake.kafka.connector.records.SnowflakeAvroConverter
  • com.snowflake.kafka.connector.records.SnowflakeAvroConverterWithoutSchemaRegistry

Use standard community converters instead:

  • org.apache.kafka.connect.json.JsonConverter
  • io.confluent.connect.avro.AvroConverter
  • io.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:

Valuev3 formatv4 formatHow 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

  1. Review breaking changes: Review the breaking changes above and determine how they affect your current deployment.

  2. Verify metadata settings: Before migrating, confirm that snowflake.metadata.topic and snowflake.metadata.offset.and.partition are enabled in your v3 connector (they’re on by default). This ensures deduplication is possible if needed.

  3. Create a new connector configuration: Create a new configuration file using the SnowflakeStreamingSinkConnector class. 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.

  4. Configure compatibility and offset migration settings: The v4 connector validates these settings at startup. You must explicitly set the following:

    • snowflake.enable.schematization: Set to true (new v4 behavior) or false (v3 behavior).
    • snowflake.validation: Set to client_side for v3 compatibility or server_side for v4 defaults.
    • snowflake.compatibility.enable.autogenerated.table.name.sanitization: Set to true for v3 compatibility.
    • snowflake.compatibility.enable.column.identifier.normalization: Set to true for v3 compatibility.
    • snowflake.streaming.classic.offset.migration: Set to skip if migrating from Snowpipe mode, or best_effort / strict if migrating from Snowpipe Streaming mode.

    For more information, see Compatibility validation.

  5. Replace custom converters: If you use Snowflake-provided converters, replace them with the community equivalents listed above.

  6. Follow the migration path for your ingestion mode: See Migrating from Snowpipe mode or Migrating from Snowpipe Streaming mode above.

  7. Test with sample data: Deploy the new connector configuration against a test environment and verify that data flows correctly before migrating production workloads.

  8. 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.

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:

# Required: new connector class
connector.class=com.snowflake.kafka.connector.SnowflakeStreamingSinkConnector

# Your existing connection settings
topics=<your-topics>
snowflake.url.name=<your-account-url>
snowflake.user.name=<your-user>
snowflake.private.key=<your-private-key>
snowflake.database.name=<your-database>
snowflake.schema.name=<your-schema>
snowflake.role.name=<your-role>

# Community converter (replaces Snowflake converters)
value.converter=org.apache.kafka.connect.json.JsonConverter
value.converter.schemas.enable=false

# Compatibility flags to reproduce v3 behavior
snowflake.validation=client_side
snowflake.compatibility.enable.autogenerated.table.name.sanitization=true
snowflake.compatibility.enable.column.identifier.normalization=true
# Set to 'false' to keep v3 RECORD_CONTENT/RECORD_METADATA columns,
# or 'true' to adopt v4 schematized columns (recommended for new tables).
snowflake.enable.schematization=false

# Offset migration: skip SSv1 migration (not needed for Snowpipe mode)
snowflake.streaming.classic.offset.migration=skip

# Disable compatibility validator after confirming config
snowflake.streaming.validate.compatibility.with.classic=false

Migrating from v3 Snowpipe Streaming mode (v3 compatible)

The following configuration reproduces v3 behavior and migrates offsets from v3 Snowpipe Streaming (SSv1) channels:

# Required: new connector class
connector.class=com.snowflake.kafka.connector.SnowflakeStreamingSinkConnector

# Your existing connection settings
topics=<your-topics>
snowflake.url.name=<your-account-url>
snowflake.user.name=<your-user>
snowflake.private.key=<your-private-key>
snowflake.database.name=<your-database>
snowflake.schema.name=<your-schema>
snowflake.role.name=<your-role>

# Community converter (replaces Snowflake converters)
value.converter=org.apache.kafka.connect.json.JsonConverter
value.converter.schemas.enable=false

# Compatibility flags to reproduce v3 behavior
snowflake.validation=client_side
snowflake.compatibility.enable.autogenerated.table.name.sanitization=true
snowflake.compatibility.enable.column.identifier.normalization=true
# Set to 'false' to keep v3 RECORD_CONTENT/RECORD_METADATA columns,
# or 'true' to adopt v4 schematized columns (recommended for new tables).
snowflake.enable.schematization=false

# Offset migration: recover offsets from v3 SSv1 channels
snowflake.streaming.classic.offset.migration=best_effort
# Must match your v3 snowflake.streaming.channel.name.include.connector.name setting
snowflake.streaming.classic.offset.migration.include.connector.name=false

# Disable compatibility validator after confirming config
snowflake.streaming.validate.compatibility.with.classic=false