diff --git a/clients/snowflake/dialect/dialect.go b/clients/snowflake/dialect/dialect.go index 54af03e3a..811bb7d57 100644 --- a/clients/snowflake/dialect/dialect.go +++ b/clients/snowflake/dialect/dialect.go @@ -154,7 +154,7 @@ WHERE UPPER(table_schema) = UPPER(?) AND table_name ILIKE ?`, dbName), []any{schemaName, "%" + constants.ArtiePrefix + "%"} } -func (SnowflakeDialect) BuildRemoveAllFilesFromStage(stageName string, path string) string { +func (SnowflakeDialect) BuildRemoveFilesFromStage(stageName string, path string) string { // https://docs.snowflake.com/en/sql-reference/sql/remove return fmt.Sprintf("REMOVE @%s", filepath.Join(stageName, path)) } diff --git a/clients/snowflake/dialect/dialect_test.go b/clients/snowflake/dialect/dialect_test.go index 30a1784f2..6f808433a 100644 --- a/clients/snowflake/dialect/dialect_test.go +++ b/clients/snowflake/dialect/dialect_test.go @@ -231,14 +231,14 @@ func TestSnowflakeDialect_BuildRemoveAllFilesFromStage(t *testing.T) { // Stage name only, no path assert.Equal(t, "REMOVE @STAGE_NAME", - SnowflakeDialect{}.BuildRemoveAllFilesFromStage("STAGE_NAME", ""), + SnowflakeDialect{}.BuildRemoveFilesFromStage("STAGE_NAME", ""), ) } { // Stage name and path assert.Equal(t, "REMOVE @STAGE_NAME/path1/subpath2", - SnowflakeDialect{}.BuildRemoveAllFilesFromStage("STAGE_NAME", "path1/subpath2"), + SnowflakeDialect{}.BuildRemoveFilesFromStage("STAGE_NAME", "path1/subpath2"), ) } } diff --git a/clients/snowflake/staging.go b/clients/snowflake/staging.go index 67b440a21..09c0aae20 100644 --- a/clients/snowflake/staging.go +++ b/clients/snowflake/staging.go @@ -90,7 +90,7 @@ func (s *Store) PrepareTemporaryTable(ctx context.Context, tableData *optimizati // This is because [PURGE = TRUE] will only delete the staging files upon a successful COPY INTO. // We also only need to do this for non-temp tables because these staging files will linger, since we create a new temporary table per attempt. if !createTempTable { - if _, deleteErr := s.ExecContext(ctx, s.dialect().BuildRemoveAllFilesFromStage(tempTableID.FullyQualifiedName(), "")); deleteErr != nil { + if _, deleteErr := s.ExecContext(ctx, s.dialect().BuildRemoveFilesFromStage(tempTableID.FullyQualifiedName(), "")); deleteErr != nil { slog.Warn("Failed to remove all files from stage", slog.Any("deleteErr", deleteErr)) } }