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

[Feature]: Add option to set user level parameter -> JDBC_QUERY_RESULT_FORMAT in Snowflake #3362

Open
1 task
suren-hf opened this issue Jan 28, 2025 · 4 comments
Labels
category:resource docs Used to mark issues with documentation remark/questions feature-request Used to mark issues with provider's missing functionalities resource:user Issue connected to the snowflake_user resource

Comments

@suren-hf
Copy link

suren-hf commented Jan 28, 2025

Company Name

Hellofresh

Use Cases or Problem Statement

Problem Statement

The snowflake_user resource currently lacks support for managing user-specific parameter -> JDBC_QUERY_RESULT_FORMAT. This forces teams to manually execute SQL scripts like:

ALTER USER SRV_RTE_MANUFACTURING SET JDBC_QUERY_RESULT_FORMAT = 'JSON';  

This gap hinders automation and consistency.

Use Case

Extending the snowflake_user resource to support JDBC_QUERY_RESULT_FORMAT parameter would simplify IaC workflows by combining user creation and parameter management in a single resource.

Category

category:resource

Object type(s)

resource:user

Proposal

Enhance the snowflake_user resource to allow setting JDBC_QUERY_RESULT_FORMAT parameter directly.

For example:

resource "snowflake_user" "example" {  
  name                    = "SRV_RTE_MANUFACTURING" 
  // Other parameters
  jdbc_query_result_format = "JSON"  
} 

This improvement streamlines automation and aligns user management with Terraform's IaC principles.

How much impact is this issue causing?

Low

Additional Information

No response

Would you like to implement a fix?

  • Yeah, I'll take it 😎
@suren-hf suren-hf added the feature-request Used to mark issues with provider's missing functionalities label Jan 28, 2025
@sfc-gh-asawicki
Copy link
Collaborator

Hey @suren-hf. Thanks for reaching out to us.

While we were reworking the snowflake_user resource, we made the decision to support "only" the parameters documented in the official Snowflake docs (https://docs.snowflake.com/en/sql-reference/parameters). It's around 60 parameters. However, there are around as many parameters undocumented but visible in the SHOW PARAMETERS IN USER output (JDBC_QUERY_RESULT_FORMAT included). Before we add any of these missing parameters, we want to have clarity: why were they not included in the docs?
For now, you can use https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/execute to avoid manual work.
You can also file an issue to official Snowflake support that the parameter is not listed in the docs.

@sfc-gh-asawicki sfc-gh-asawicki added resource:user Issue connected to the snowflake_user resource category:documentation category:resource labels Jan 29, 2025
@sfc-gh-dszmolka
Copy link
Collaborator

sfc-gh-dszmolka commented Feb 3, 2025

out of curiosity, and if you can share: why do you even need JDBC_QUERY_RESULT_FORMAT ? resultset by default -for all drivers- is and should be Arrow, and we usually only recommend using JDBC_QUERY_RESULT_FORMAT=JSON as a last resort for some kind of misbehaviour of a particular driver in a particular corner case.

Maybe it would be possible to address the underlying root cause instead of resorting to workarounds? Since it's related to JDBC, i'm almost sure it has nothing to do with this TF Provider (written in Go), but I'm still curious and I think we can find the proper channels to help you with the underlying root cause, if that's something which is not discovered yet.

@suren-hf
Copy link
Author

suren-hf commented Feb 4, 2025

@sfc-gh-asawicki @sfc-gh-dszmolka Thank you both for looking into this issue.

You can also file an issue to official Snowflake support that the parameter is not listed in the docs.

@sfc-gh-asawicki - That sounds like a good idea. I will check with the Snowflake support team why some of these parameters are not documented in their official docs.

why do you even need JDBC_QUERY_RESULT_FORMAT ?

@sfc-gh-dszmolka - You are correct. The default result-set format is indeed JSON. However, we faced this issue while trying to use the Kafka Snowflake Sink Connector (jar link -> https://repo1.maven.org/maven2/com/snowflake/snowflake-kafka-connector/).
The exact error we saw in the connector logs was Failure in Streaming Channel Offset Migration Response error while trying to consume message from t1 Kafka topic and the fix for it was to set the JDBC_QUERY_RESULT_FORMAT='JSON';. It might not be clear from these details, so please check below link to better understand the issue.
https://community.snowflake.com/s/article/Getting-java-lang-NoClassDefFoundError-for-class-RootAllocator

@sfc-gh-dszmolka
Copy link
Collaborator

I see, thank you for sharing the details about why you need to use JDBC_QUERY_RESULT_FORMAT='JSON.

@sfc-gh-asawicki sfc-gh-asawicki added docs Used to mark issues with documentation remark/questions and removed category:documentation labels Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:resource docs Used to mark issues with documentation remark/questions feature-request Used to mark issues with provider's missing functionalities resource:user Issue connected to the snowflake_user resource
Projects
None yet
Development

No branches or pull requests

3 participants