diff --git a/pkg/snowflake/stage.go b/pkg/snowflake/stage.go index 4c445a1839..21eb15e802 100644 --- a/pkg/snowflake/stage.go +++ b/pkg/snowflake/stage.go @@ -142,7 +142,7 @@ func (sb *StageBuilder) Create() string { } if sb.storageIntegration != "" { - q.WriteString(fmt.Sprintf(` STORAGE_INTEGRATION = %v`, sb.storageIntegration)) + q.WriteString(fmt.Sprintf(` STORAGE_INTEGRATION = "%v"`, sb.storageIntegration)) } if sb.encryption != "" { @@ -195,7 +195,7 @@ func (sb *StageBuilder) ChangeCredentials(c string) string { // ChangeStorageIntegration returns the SQL query that will update the storage integration on the stage. func (sb *StageBuilder) ChangeStorageIntegration(s string) string { - return fmt.Sprintf(`ALTER STAGE %v SET STORAGE_INTEGRATION = %v`, sb.QualifiedName(), s) + return fmt.Sprintf(`ALTER STAGE %v SET STORAGE_INTEGRATION = "%v"`, sb.QualifiedName(), s) } // ChangeEncryption returns the SQL query that will update the encryption on the stage. diff --git a/pkg/snowflake/stage_test.go b/pkg/snowflake/stage_test.go index 6a460aec82..81ae91476b 100644 --- a/pkg/snowflake/stage_test.go +++ b/pkg/snowflake/stage_test.go @@ -35,7 +35,7 @@ func TestStageCreate(t *testing.T) { r.Equal(`CREATE STAGE "test_db"."test_schema"."test_stage" URL = 's3://load/encrypted_files/' CREDENTIALS = (aws_role='arn:aws:iam::001234567890:role/mysnowflakerole') ENCRYPTION = (type='AWS_SSE_KMS' kms_key_id = 'aws/key') FILE_FORMAT = (format_name=my_csv_format) COPY_OPTIONS = (on_error='skip_file') DIRECTORY = (ENABLE=TRUE) COMMENT = 'Yee\'haw'`, s.Create()) s.WithStorageIntegration("MY_INTEGRATION") - r.Equal(`CREATE STAGE "test_db"."test_schema"."test_stage" URL = 's3://load/encrypted_files/' CREDENTIALS = (aws_role='arn:aws:iam::001234567890:role/mysnowflakerole') STORAGE_INTEGRATION = MY_INTEGRATION ENCRYPTION = (type='AWS_SSE_KMS' kms_key_id = 'aws/key') FILE_FORMAT = (format_name=my_csv_format) COPY_OPTIONS = (on_error='skip_file') DIRECTORY = (ENABLE=TRUE) COMMENT = 'Yee\'haw'`, s.Create()) + r.Equal(`CREATE STAGE "test_db"."test_schema"."test_stage" URL = 's3://load/encrypted_files/' CREDENTIALS = (aws_role='arn:aws:iam::001234567890:role/mysnowflakerole') STORAGE_INTEGRATION = "MY_INTEGRATION" ENCRYPTION = (type='AWS_SSE_KMS' kms_key_id = 'aws/key') FILE_FORMAT = (format_name=my_csv_format) COPY_OPTIONS = (on_error='skip_file') DIRECTORY = (ENABLE=TRUE) COMMENT = 'Yee\'haw'`, s.Create()) } func TestStageRename(t *testing.T) { @@ -83,7 +83,7 @@ func TestStageChangeCredentials(t *testing.T) { func TestStageChangeStorageIntegration(t *testing.T) { r := require.New(t) s := Stage("test_stage", "test_db", "test_schema") - r.Equal(s.ChangeStorageIntegration("MY_INTEGRATION"), `ALTER STAGE "test_db"."test_schema"."test_stage" SET STORAGE_INTEGRATION = MY_INTEGRATION`) + r.Equal(s.ChangeStorageIntegration("MY_INTEGRATION"), `ALTER STAGE "test_db"."test_schema"."test_stage" SET STORAGE_INTEGRATION = "MY_INTEGRATION"`) } func TestStageChangeCopyOptions(t *testing.T) {