struct
CQL::ActiveRecord::BulkInsert
- CQL::ActiveRecord::BulkInsert
- Struct
- Value
- Object
Overview
Multi-row INSERT behind Model.insert_all and Model.upsert_all. Every row is checked before
the first statement, and a run of several batches commits or rolls back as a whole.
Defined in:
active_record/bulk_insert.crConstant Summary
-
TIMESTAMP_COLUMNS =
{:created_at, :updated_at}
Constructors
-
.new(schema : CQL::Schema, table : Symbol, rows : Array(Row), generate_id : -> DB::Any | Nil = nil, conflict : Conflict | Nil = nil, primary_key : Symbol = :id)
generate_id fills a missing or nil primary_key (UUID and ULID keys); without it a nil key is dropped so the database assigns one.
Instance Method Summary
-
#call(batch_size : Int32 | Nil = nil) : Int64
Inserts the rows, batch_size per statement (by default as many as the dialect's bind-parameter limit allows), and returns the number of rows inserted.
-
#first_statement(batch_size : Int32 | Nil = nil) : CQL::Insert | Nil
The statement
#callsends for the first batch, checked and built but not run.
Constructor Detail
generate_id fills a missing or nil primary_key (UUID and ULID keys); without it a nil key is dropped so the database assigns one.
Instance Method Detail
Inserts the rows, batch_size per statement (by default as many as the dialect's bind-parameter limit allows), and returns the number of rows inserted.
The statement #call sends for the first batch, checked and built but not run.