Skip to content

SnowflakeIO yaml - #39742

Merged
Amar3tto merged 11 commits into
masterfrom
snowflakeio-yaml
Aug 26, 2026
Merged

SnowflakeIO yaml#39742
Amar3tto merged 11 commits into
masterfrom
snowflakeio-yaml

Conversation

@Amar3tto

@Amar3tto Amar3tto commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Fixes #28691

Adds Beam YAML support for Snowflake IO.

  • Adds ReadFromSnowflake for batch reads from a table or query.
  • Adds WriteToSnowflake for batch writes and streaming writes via Snowpipe.
  • Supports password, OAuth, and private key authentication.
  • Adds Beam Row / Snowflake schema conversion.
  • Registers both transforms in standard_io.yaml.
  • Adds unit tests for configuration, authentication, schema mapping, and batch/streaming behavior.

https://github.com/apache/beam/actions/runs/31692701363
https://github.com/apache/beam/actions/runs/31691059139


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

import org.apache.beam.sdk.values.Row;

/** A {@link SchemaTransformProvider} for reading rows from Snowflake. */
@SuppressWarnings({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer not introducing SuppressWarnings for new code

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

})
public class SnowflakeSchemaTransformUtils {

public static SnowflakeIO.DataSourceConfiguration createDataSourceConfiguration(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just make SnowflakeReadSchemaTransformProvider.Configuration as createDataSourceConfiguration's parameter?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is shared by both the read and write providers, which have different configuration classes. Passing the individual fields keeps this utility independent of either provider-specific configuration.


String debugMode = getDebugMode();
if (debugMode != null) {
parseStreamingLogLevel(debugMode);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return value is unused. I understand it's for validation. Consider add a comment noting it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check, I don't see a code change?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added one comment above (line 142) for the whole part:

Parse configured enum values to validate that they are supported.

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @claudevdm for label python.
R: @kennknowles for label java.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@Amar3tto
Amar3tto requested a review from Abacn August 17, 2026 20:50
@derrickaw

Copy link
Copy Markdown
Collaborator

Hi @Amar3tto, can you add a yaml pipeline test under yaml/tests or yaml/extended_tests with any improvements necessary in integration_tests.py? Thanks.

@Amar3tto

Copy link
Copy Markdown
Collaborator Author

Hi @Amar3tto, can you add a yaml pipeline test under yaml/tests or yaml/extended_tests with any improvements necessary in integration_tests.py? Thanks.

Added a Snowflake YAML pipeline test under yaml/extended_tests/databases together with the required fixture in integration_tests.py.
Currently the existing Snowflake integration test is not run by CI and the YAML PostCommit does not provide Snowflake credentials/configuration either, so the test will be skipped until those are configured.

Comment thread sdks/python/build.gradle Outdated
dependsOn ":sdks:java:io:expansion-service:build"
dependsOn ":sdks:java:io:google-cloud-platform:expansion-service:build"
dependsOn ":sdks:java:io:debezium:expansion-service:shadowJar"
dependsOn ":sdks:java:io:snowflake:expansion-service:shadowJar"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider move this to postCommitYamlIntegrationTests. The test only need to be exercised on postsubmit time. The PreCommit becomes heavier as we are adding more expansion services (and test container). Same apply to kenesis / JmsIO / debezium

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Amar3tto
Amar3tto requested a review from Abacn August 25, 2026 12:54
*/
@FunctionalInterface
public interface UserDataMapper<T> extends Serializable {
@org.checkerframework.checker.nullness.qual.Nullable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Import the name

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept javax.annotation.Nullable as the existing import to avoid conflicting Nullable imports. The Checker Framework annotation is only needed for this specific type-use case, so I used its fully qualified name there

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should replace all with org.checkerframework.checker.nullness.qual.Nullable, which is Beam repo's convention. But code completion tool keeps adding javax and sometimes slipped from review

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


String debugMode = getDebugMode();
if (debugMode != null) {
parseStreamingLogLevel(debugMode);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check, I don't see a code change?

Comment thread sdks/java/io/snowflake/build.gradle Outdated
implementation project(path: ":sdks:java:extensions:google-cloud-platform-core")
permitUnusedDeclared project(path: ":sdks:java:extensions:google-cloud-platform-core")
implementation library.java.slf4j_api
implementation library.java.everit_json_schema

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need it now? Is it now a runtime dependency, or needed by the expansion service now?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a runtime dependency of the new read SchemaTransform. JsonUtils.beamSchemaFromJsonSchema(...) uses Everit JSON Schema to parse the configured output schema, and the expansion service picks it up transitively from the Snowflake IO module.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's transient dependency shouldn't need to be added here. In fact it's a dependency of Java core:

implementation library.java.everit_json_schema

In general new codes should not need permitUnusedDeclared ...

@Amar3tto Amar3tto Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried removing the dependency, but :sdks:java:io:snowflake:compileJava then fails with:

class file for org.everit.json.schema.ObjectSchema not found

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks, then consider declare it as "provided", in align with

provided library.java.everit_json_schema

provided library.java.everit_json_schema

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to provided, thanks

@Amar3tto
Amar3tto requested a review from Abacn August 26, 2026 14:52

@Abacn Abacn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Amar3tto
Amar3tto merged commit 8cfbd8e into master Aug 26, 2026
116 of 117 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[yaml] Normalize SnowflakeIO

3 participants