SapHanaWriteToServerExecution

An enumeration that is being used to define the behavior of the bulk-import write when executing towards the underlying target table.

This enum defines how the Async overloads of the RepoDb.SapHana.BulkOperations operations write rows to the server. It is read from SapHanaBulkDbSetting.WriteToServerExecution, which is not registered by default.

Enum Values

Name Description
SapHanaCommandBatcher A compatibility fallback. Writes through SapHanaCommandBatcher, which executes one parameterized INSERT round trip per row. It is dramatically slower than AsyncOverSync for any non-trivial row count, so only select it explicitly for environments where HanaBulkCopy itself cannot be used.
AsyncOverSync The default. Offloads the real, synchronous HanaBulkCopy bulk load onto a background thread via Task.Run. The calling thread is not blocked, at the cost of holding a thread-pool thread for the duration of the load. By far the fastest option for any non-trivial row count — HanaBulkCopy has no native async API, so this is the best the driver allows.

The sync overloads always use HanaBulkCopy directly, regardless of this setting — it only affects the Async overloads.

Usability

AsyncOverSync is already the default on a SapHanaBulkDbSetting instance. Set the value explicitly and pass the instance to UseSapHana() to fall back to the row-by-row batcher.

GlobalConfiguration
    .Setup()
    .UseSapHana(new SapHanaBulkDbSetting { WriteToServerExecution = SapHanaWriteToServerExecution.SapHanaCommandBatcher });