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

feat: add on_account to session and object params #1685

Merged
merged 5 commits into from
Apr 3, 2023

Conversation

sfc-gh-swinkler
Copy link
Collaborator

@sfc-gh-swinkler sfc-gh-swinkler commented Mar 31, 2023

Allows session params to be created either on account or on user. And object params to be created either on an object, or on account.
issues #1565 , #1546

@github-actions
Copy link

Integration tests failure for 8a178eeaf8dffacfc103f62e88acaeb5c455c3eb

@github-actions
Copy link

Integration tests failure for 3cff2eb3def90f33a840e78d8fd45c0223ce38b1

@github-actions
Copy link

Integration tests success for a0b47aff7f01ef03a603f4a5762075d29d23dcd7

Comment on lines 736 to 739
// prepared statements do not work here for some reason. We already validate inputs so its okay
stmt := fmt.Sprintf("ALTER ACCOUNT SET %s = %s", v.key, v.value)
_, err := v.db.Exec(stmt)
return err
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 reuse AccountParameterBuilder.SetParameter to avoid duplicating this SQL? I assume these two use cases are functionally identical.

Comment on lines 784 to 787
// prepared statements do not work here for some reason. We already validate inputs so its okay
stmt := fmt.Sprintf("ALTER ACCOUNT SET %s = %s", v.key, v.value)
_, err := v.db.Exec(stmt)
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

pkg/snowflake/parameters.go Show resolved Hide resolved
pkg/snowflake/parameters.go Outdated Show resolved Hide resolved
pkg/snowflake/parameters.go Show resolved Hide resolved
@@ -143,9 +154,12 @@ func CreateObjectParameter(d *schema.ResourceData, meta interface{}) error {
func ReadObjectParameter(d *schema.ResourceData, meta interface{}) error {
db := meta.(*sql.DB)
id := d.Id()
parts := strings.Split(id, "❄️")
parts := strings.Split(id, "|")
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe worth extracting "|" into a global variable to avoid magic values.

@@ -15,7 +16,7 @@ var parametersSchema = map[string]*schema.Schema{
"parameter_type": {
Type: schema.TypeString,
Optional: true,
Default: "SESSION",
Default: "ACCOUNT",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this backward compatible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the old behavior "SESSION" was actually the same as "ACCOUNT", hence setting it as "ACCOUNT" is the most sensible. This is generally what people want to do anyways

@github-actions
Copy link

github-actions bot commented Apr 1, 2023

Integration tests failure for ae21f4dc832cb1f919b807bc91a39a28c356d6dc

@github-actions
Copy link

github-actions bot commented Apr 1, 2023

Integration tests success for 3449e6a0bd14e5ec0d928db9d1830c7db29d64a1

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.

2 participants