Skip to content

Commit

Permalink
materialize-snowflake: use dialect identifier transformer for schema
Browse files Browse the repository at this point in the history
  • Loading branch information
mdibaiee committed Mar 15, 2024
1 parent b5c4ce3 commit 4065367
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions materialize-snowflake/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ func (c *client) CreateTable(ctx context.Context, tc sql.TableCreate) error {
}
defer conn.Close()

if _, err := conn.ExecContext(ctx, fmt.Sprintf("CREATE SCHEMA IF NOT EXISTS %q", schemaName)); err != nil {
if _, err := conn.ExecContext(ctx, fmt.Sprintf("CREATE SCHEMA IF NOT EXISTS %s", c.ep.Dialect.Identifier(schemaName))); err != nil {
return err
}

if _, err := conn.ExecContext(ctx, fmt.Sprintf("USE SCHEMA %q", c.cfg.Schema)); err != nil {
if _, err := conn.ExecContext(ctx, fmt.Sprintf("USE SCHEMA %s", c.ep.Dialect.Identifier(c.cfg.Schema))); err != nil {
return err
}

Expand All @@ -89,7 +89,7 @@ func (c *client) DeleteTable(ctx context.Context, path []string) (string, boiler
}
defer conn.Close()

if _, err := conn.ExecContext(ctx, fmt.Sprintf("USE SCHEMA %q", c.cfg.Schema)); err != nil {
if _, err := conn.ExecContext(ctx, fmt.Sprintf("USE SCHEMA %s", c.ep.Dialect.Identifier(c.cfg.Schema))); err != nil {
return err
}
_, err = conn.ExecContext(ctx, stmt)
Expand All @@ -111,7 +111,7 @@ func (c *client) AlterTable(ctx context.Context, ta sql.TableAlter) (string, boi
}
defer conn.Close()

if _, err := conn.ExecContext(ctx, fmt.Sprintf("USE SCHEMA %q", c.cfg.Schema)); err != nil {
if _, err := conn.ExecContext(ctx, fmt.Sprintf("USE SCHEMA %s", c.ep.Dialect.Identifier(c.cfg.Schema))); err != nil {
return err
}
_, err = conn.ExecContext(ctx, alterColumnStmt)
Expand Down

0 comments on commit 4065367

Please sign in to comment.