Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-826772 Unification of Snowflake role and user for Snowpipe Streaming #650

Merged
merged 5 commits into from
Jun 16, 2023

Conversation

sfc-gh-japatel
Copy link
Collaborator

@sfc-gh-japatel sfc-gh-japatel commented Jun 13, 2023

  • Here is what the connection object is used for: [Only for Snowpipe Streaming]
    • DB existence checker.
    • Schema existence checker.
    • CreateTable
    • Alter table

Do you need test for this change?

  • Existing tests uses a user and a uses a default role. [Check profile.json]
    • Verifying existing tests passes is enough.
    • ConnectionServiceIT is one test which verifies this code path.
  • It's not worth adding the another profile.json and modifying the existing tests to use a new user/role.
  • Manual tests: Ran a manual test in sfctest0 account with a new role and a new user. Also ran a test which revoked an insert privilege from this role and it resulted into channel open error.

Can anything go wrong with this change?

  • Yes, if the default role of the user has more privileges than the role supplied. The role being used for Snowpipe Streaming needs atleast an insert privilege. But most of the times, an insert priv is accompanied by usage priv as well.
    • We will be adding this change in a new 2.0.0 version of Kafka Connector, so this will be advertised/documented.
    • Only affects Snowpipe Streaming.

@codecov
Copy link

codecov bot commented Jun 13, 2023

Codecov Report

Merging #650 (6164e89) into master (f8da3c5) will decrease coverage by 0.02%.
The diff coverage is 77.77%.

@@            Coverage Diff             @@
##           master     #650      +/-   ##
==========================================
- Coverage   88.02%   88.01%   -0.02%     
==========================================
  Files          50       50              
  Lines        4124     4137      +13     
  Branches      445      448       +3     
==========================================
+ Hits         3630     3641      +11     
- Misses        327      329       +2     
  Partials      167      167              
Impacted Files Coverage Δ
...wflake/kafka/connector/internal/InternalUtils.java 92.30% <71.42%> (-1.33%) ⬇️
...or/internal/SnowflakeConnectionServiceFactory.java 96.66% <100.00%> (+0.11%) ⬆️

... and 6 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@sfc-gh-tzhang sfc-gh-tzhang left a comment

Choose a reason for hiding this comment

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

lgtm!

if (ingestionMethodConfig == IngestionMethodConfig.SNOWPIPE_STREAMING) {
final String providedSFRoleInConfig = conf.get(Utils.SF_ROLE);
if (!Strings.isNullOrEmpty(providedSFRoleInConfig)) {
LOGGER.debug("Using provided role {} for JDBC connection.", providedSFRoleInConfig);
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we combine the log here with the one in the else branch?

Copy link
Contributor

Choose a reason for hiding this comment

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

And I suggest to use INFO since DEBUG logging at this point is useless due to the large number of debug logging in the ingest SDK

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, makes sense. no harm in using info.

* @param sslEnabled is sslEnabled?
* @return Properties object which will be passed down to JDBC connection
*/
static Properties createProperties(Map<String, String> conf, boolean sslEnabled) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we add snowpipe something to this method name (createPropertiesForSnowpipe) or mention in the comments its for snowpipe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didnt want make number of changes in test classes to reflect this change. I can add comment about using default ingestmethodconfig

@sfc-gh-japatel sfc-gh-japatel merged commit f3a9fb6 into master Jun 16, 2023
@sfc-gh-japatel sfc-gh-japatel deleted the japatel-role-unification branch June 16, 2023 19:47
khsoneji pushed a commit to confluentinc/snowflake-kafka-connector that referenced this pull request Oct 12, 2023
khsoneji pushed a commit to confluentinc/snowflake-kafka-connector that referenced this pull request Oct 12, 2023
khsoneji pushed a commit to confluentinc/snowflake-kafka-connector that referenced this pull request Oct 12, 2023
khsoneji pushed a commit to confluentinc/snowflake-kafka-connector that referenced this pull request Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants