Skip to content

Commit

Permalink
[redshift] Remove uppercaseEscapedNames support (#496)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-artie authored Apr 23, 2024
1 parent 0e9bf11 commit 1b7155b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion clients/redshift/redshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (s *Store) Label() constants.DestinationKind {
}

func (s *Store) ShouldUppercaseEscapedNames() bool {
return s.config.SharedDestinationConfig.UppercaseEscapedNames
return false
}

func (s *Store) GetTableConfig(tableData *optimization.TableData) (*types.DwhTableConfig, error) {
Expand Down
12 changes: 8 additions & 4 deletions lib/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,24 @@ func readFileToConfig(pathToConfig string) (*Config, error) {

func (c Config) ValidateRedshift() error {
if c.Output != constants.Redshift {
return fmt.Errorf("output is not redshift, output: %v", c.Output)
return fmt.Errorf("output is not Redshift, output: %v", c.Output)
}

if c.Redshift == nil {
return fmt.Errorf("redshift cfg is nil")
return fmt.Errorf("cfg for Redshift is nil")
}

if empty := stringutil.Empty(c.Redshift.Host, c.Redshift.Database, c.Redshift.Username,
c.Redshift.Password, c.Redshift.Bucket, c.Redshift.CredentialsClause); empty {
return fmt.Errorf("one of redshift settings is empty")
return fmt.Errorf("one of Redshift settings is empty")
}

if c.Redshift.Port <= 0 {
return fmt.Errorf("redshift invalid port")
return fmt.Errorf("invalid Redshift port")
}

if c.SharedDestinationConfig.UppercaseEscapedNames {
return fmt.Errorf("uppercaseEscapedNames is not supported for Redshift")
}

return nil
Expand Down
8 changes: 4 additions & 4 deletions lib/config/config_validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ func TestCfg_ValidateRedshift(t *testing.T) {
{
name: "nil",
redshift: nil,
expectedErr: "redshift cfg is nil",
expectedErr: "cfg for Redshift is nil",
},
{
name: "redshift settings exist, but all empty",
redshift: &Redshift{},
expectedErr: "one of redshift settings is empty",
expectedErr: "one of Redshift settings is empty",
},
{
name: "redshift settings all set (missing port)",
Expand All @@ -103,7 +103,7 @@ func TestCfg_ValidateRedshift(t *testing.T) {
Bucket: "bucket",
CredentialsClause: "creds",
},
expectedErr: "redshift invalid port",
expectedErr: "invalid Redshift port",
},
{
name: "redshift settings all set (neg port)",
Expand All @@ -116,7 +116,7 @@ func TestCfg_ValidateRedshift(t *testing.T) {
Bucket: "bucket",
CredentialsClause: "creds",
},
expectedErr: "redshift invalid port",
expectedErr: "invalid Redshift port",
},
{
name: "redshift settings all set",
Expand Down

0 comments on commit 1b7155b

Please sign in to comment.