Skip to content

Commit

Permalink
Changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jcieslak committed Nov 13, 2023
1 parent 56f66c0 commit 1ff5f07
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions pkg/sdk/file_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,8 @@ type CreateFileFormatOptions struct {
IfNotExists *bool `ddl:"keyword" sql:"IF NOT EXISTS"`
name SchemaObjectIdentifier `ddl:"identifier"`
Type FileFormatType `ddl:"parameter" sql:"TYPE"`
Comment *string `ddl:"parameter,single_quotes" sql:"SET COMMENT"`

FileFormatTypeOptions
Comment *string `ddl:"parameter,single_quotes" sql:"COMMENT"`
}

func (opts *CreateFileFormatOptions) validate() error {
Expand Down
2 changes: 1 addition & 1 deletion pkg/sdk/poc/generator/keyword_builders.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (v *QueryStruct) NamedListWithParens(sqlPrefix string, listItemKind string,
return v
}

func (v *QueryStruct) WithTags() *QueryStruct {
func (v *QueryStruct) OptionalTags() *QueryStruct {
return v.NamedListWithParens("TAG", "TagAssociation", nil)
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/sdk/stages_gen_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ func TestStages_CreateOnS3(t *testing.T) {
assertOptsInvalidJoinedErrors(t, opts, errOneOf(".ExternalStageParams", "StorageIntegration", "Credentials"))
})

t.Run("validation: conflicting fields for [opts.ExternalStageParams.Credentials.AwsKeyId opts.ExternalStageParams.Credentials.AwsRole]", func(t *testing.T) {
t.Run("validation: conflicting fields for [opts.ExternalStageParams.Credentials.AWSKeyId opts.ExternalStageParams.Credentials.AWSRole]", func(t *testing.T) {
opts := defaultOpts()
opts.ExternalStageParams = &ExternalS3StageParams{
Credentials: &ExternalStageS3Credentials{
AWSKeyId: String("aws-key-id"),
AWSRole: String("aws-role"),
},
}
assertOptsInvalidJoinedErrors(t, opts, errOneOf(".ExternalStageParams.Credentials", "AwsKeyId", "AwsRole"))
assertOptsInvalidJoinedErrors(t, opts, errOneOf(".ExternalStageParams.Credentials", "AWSKeyId", "AWSRole"))
})

t.Run("all options - storage integration", func(t *testing.T) {
Expand Down Expand Up @@ -477,15 +477,15 @@ func TestStages_AlterExternalS3Stage(t *testing.T) {
assertOptsInvalidJoinedErrors(t, opts, errOneOf(".ExternalStageParams", "StorageIntegration", "Credentials"))
})

t.Run("validation: conflicting fields for [opts.ExternalStageParams.Credentials.AwsKeyId opts.ExternalStageParams.Credentials.AwsRole]", func(t *testing.T) {
t.Run("validation: conflicting fields for [opts.ExternalStageParams.Credentials.AWSKeyId opts.ExternalStageParams.Credentials.AWSRole]", func(t *testing.T) {
opts := defaultOpts()
opts.ExternalStageParams = &ExternalS3StageParams{
Credentials: &ExternalStageS3Credentials{
AWSKeyId: String("aws-key-id"),
AWSRole: String("aws-role"),
},
}
assertOptsInvalidJoinedErrors(t, opts, errOneOf(".ExternalStageParams.Credentials", "AwsKeyId", "AwsRole"))
assertOptsInvalidJoinedErrors(t, opts, errOneOf(".ExternalStageParams.Credentials", "AWSKeyId", "AWSRole"))
})

t.Run("all options", func(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/sdk/views_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var viewColumnMaskingPolicy = g.NewQueryStruct("ViewColumnMaskingPolicy").
Text("Name", g.KeywordOptions().Required()).
Identifier("MaskingPolicy", g.KindOfT[SchemaObjectIdentifier](), g.IdentifierOptions().SQL("MASKING POLICY").Required()).
NamedListWithParens("USING", g.KindOfT[string](), nil). // TODO: double quotes here?
WithTags()
OptionalTags()

var viewRowAccessPolicy = g.NewQueryStruct("ViewRowAccessPolicy").
Identifier("RowAccessPolicy", g.KindOfT[SchemaObjectIdentifier](), g.IdentifierOptions().SQL("ROW ACCESS POLICY").Required()).
Expand Down Expand Up @@ -147,7 +147,7 @@ var ViewsDef = g.NewInterface(
// In the current docs ROW ACCESS POLICY and TAG are specified twice.
// It is a mistake probably so here they are present only once.
OptionalQueryStructField("RowAccessPolicy", viewRowAccessPolicy, g.KeywordOptions()).
WithTags().
OptionalTags().
SQL("AS").
Text("sql", g.KeywordOptions().NoQuotes().Required()).
WithValidation(g.ValidIdentifier, "name").
Expand Down

0 comments on commit 1ff5f07

Please sign in to comment.