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 app packages #2323

Merged
merged 5 commits into from
Jan 18, 2024
Merged

feat: add app packages #2323

merged 5 commits into from
Jan 18, 2024

Conversation

sfc-gh-swinkler
Copy link
Collaborator

Copy link

github-actions bot commented Jan 8, 2024

Integration tests failure for c38f951c7e00ba613d045d82880402154baef6d4

pkg/sdk/testint/application_packages_integration_test.go Outdated Show resolved Hide resolved
pkg/sdk/application_packages_def.go Outdated Show resolved Hide resolved
pkg/sdk/application_packages_def.go Show resolved Hide resolved
OptionalSetTags().
OptionalUnsetTags().
WithValidation(g.ValidIdentifier, "name").
WithValidation(g.ExactlyOneValueSet, "Set", "UnsetDataRetentionTimeInDays", "UnsetMaxDataExtensionTimeInDays", "UnsetDefaultDdlCollation", "UnsetComment", "UnsetDistribution", "ModifyReleaseDirective", "SetDefaultReleaseDirective", "SetReleaseDirective", "UnsetReleaseDirective", "AddVersion", "DropVersion", "AddPatchForVersion", "SetTags", "UnsetTags"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

why you treat set and unset differently (I mean these 5: "UnsetDataRetentionTimeInDays", "UnsetMaxDataExtensionTimeInDays", "UnsetDefaultDdlCollation", "UnsetComment", "UnsetDistribution")? And why we are limiting the unset query to just one unset per statement? According to the docs we can unset multiple parameters as one statement. This is also what we are doing for other resources.

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 tried, set multiple params works, but unset multiple params does not work

Copy link
Collaborator

@sfc-gh-asawicki sfc-gh-asawicki Jan 17, 2024

Choose a reason for hiding this comment

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

It works according to the docs: https://docs.snowflake.com/en/sql-reference/sql/alter-application-package#syntax. I checked it with a sample code:

-- DROP APPLICATION PACKAGE "aswtesting17012024";
CREATE APPLICATION PACKAGE "aswtesting17012024";
ALTER APPLICATION PACKAGE  "aswtesting17012024" SET COMMENT = 'some comment' DISTRIBUTION = INTERNAL;
ALTER APPLICATION PACKAGE  "aswtesting17012024" UNSET COMMENT, DISTRIBUTION;

I guess that the comma is missing for the UNSET in the docs but it seems to work just fine.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

created an unset helper struct

Copy link
Collaborator

Choose a reason for hiding this comment

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

But still, you limited it to just one field that can be unset, while according to the SQL statements I have attached above you can do multiple unset.

It should be configured similarly to e.g. storage integration.

So in your case please change:

OptionalQueryStructField(
			"Unset",
			applicationPackageUnset,
			g.KeywordOptions().SQL("UNSET"),
		).

to

OptionalQueryStructField(
			"Unset",
			applicationPackageUnset,
			g.ListOptions().NoParentheses().SQL("UNSET"),
		).

and
validation type in applicationPackageUnset from ExactlyOneValueSet to AtLeastOneValueSet.

We can merge this one and you will correct it in the follow-up PR. WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, i will fix in a follow up PR

pkg/sdk/application_packages_def.go Outdated Show resolved Hide resolved
Copy link

Integration tests failure for 89d07384390b6ec16feb9fb0e28d74ddb877b589

Copy link

Integration tests failure for 15613015edbdd9cdb184a9f5e6d2492e17248dea

Copy link
Collaborator

@sfc-gh-asawicki sfc-gh-asawicki left a comment

Choose a reason for hiding this comment

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

LGTM, just this unset thing left.

@sfc-gh-asawicki sfc-gh-asawicki self-requested a review January 18, 2024 08:30
@sfc-gh-swinkler sfc-gh-swinkler merged commit ca030fc into main Jan 18, 2024
4 of 7 checks passed
@sfc-gh-swinkler sfc-gh-swinkler deleted the app-pkg branch January 18, 2024 19:06
Copy link

Integration tests failure for 98ec7bb00d32e547e8347275b0a0ff4e29e644be

sfc-gh-asawicki pushed a commit that referenced this pull request Jan 23, 2024
Follow up PR from discussion in original PR 


#2323 (comment)

Fixing Unset to use commas, allowing multiple unsets
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.

3 participants