Skip to content

Commit

Permalink
use temp table for incremental/backfill with SLING_DIRECT_INSERT
Browse files Browse the repository at this point in the history
  • Loading branch information
flarco committed Oct 30, 2024
1 parent 6ce48ad commit 270446a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/sling/task_run_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ func (t *TaskExecution) WriteToDb(cfg *Config, df *iop.Dataflow, tgtConn databas

// write directly to the final table (no temp table)
if directInsert := cast.ToBool(os.Getenv("SLING_DIRECT_INSERT")); directInsert {
return t.writeToDbDirectly(cfg, df, tgtConn)
if g.In(cfg.Mode, IncrementalMode, BackfillMode) && len(cfg.Source.PrimaryKey()) > 0 {
g.Warn("mode '%s' with a primary-key is not supported for direct write, falling back to using a temporary table.", cfg.Mode)
} else {
return t.writeToDbDirectly(cfg, df, tgtConn)
}
}

// Initialize target and temp tables
Expand Down

0 comments on commit 270446a

Please sign in to comment.