ClickHouseBulkImportIdentityBehavior
This enum defines the behavior of the identity property/column when an entity is bulk-imported into a target table. It applies to RepoDb.ClickHouse.BulkOperations.
Enum Values
| Name | Description |
|---|---|
| KeepIdentity | The identity/key value is written to the target table exactly as supplied on the entity. This is the only supported behavior, and the default. |
| ReturnIdentity | Not supported. ClickHouse has no session-wide scope identity, sequence, or auto-increment mechanism, so requesting this value throws a NotSupportedException. |
Usability
This enum is used by both the BulkInsert and BulkMerge operations. Since KeepIdentity is the default, most callers never need to pass it explicitly.
using (var connection = new ClickHouseConnection(connectionString))
{
var people = GetPeople(1000);
var insertedRows = connection.BulkInsert(people,
identityBehavior: ClickHouseBulkImportIdentityBehavior.KeepIdentity);
}
Passing
identityBehavior: ClickHouseBulkImportIdentityBehavior.ReturnIdentityto BulkInsert or BulkMerge always throwsNotSupportedException— ClickHouse has no mechanism to generate or return identity values. Assign key values on the entity yourself before calling either operation.