bulk import2

This commit is contained in:
Filipriec
2026-08-21 22:37:30 +02:00
parent 0756e99959
commit adaa2c4ac6
8 changed files with 421 additions and 207 deletions

View File

@@ -29,17 +29,6 @@ service TablesData {
rpc PostAccountingTableData(PostAccountingTableDataRequest)
returns (PostTableDataResponse);
// Insert multiple rows atomically by applying PostTableData behavior to each row.
//
// Behavior:
// - Accepts 1..10,000 rows in one gRPC request
// - Processes rows in request order
// - Each row is inserted through the same validation, script execution,
// typed binding, database insert, and indexing path as PostTableData
// - Stops at the first failing row and returns that row's gRPC error code
// - Commits only when every row succeeds; a failure rolls the entire request back
rpc PostTableDataBulk(PostTableDataBulkRequest) returns (PostTableDataBulkResponse);
// Starts a durable, profile-scoped import staging session. Staging never changes
// profile data; CommitTableDataImport applies every staged chunk atomically.
rpc BeginTableDataImport(BeginTableDataImportRequest)
@@ -189,36 +178,6 @@ message PostTableDataResponse {
optional int64 journal_id = 5;
}
// One row in a bulk insert request.
message PostTableDataBulkRow {
// Required. Same data payload as PostTableDataRequest.data.
map<string, google.protobuf.Value> data = 1;
}
// Bulk insert request.
message PostTableDataBulkRequest {
// Required. Profile (PostgreSQL schema) name that owns the table.
string profile_name = 1;
// Required. Logical table (definition) name within the profile.
string table_name = 2;
// Required. Rows to insert. Must contain at least 1 and at most 10,000 rows.
repeated PostTableDataBulkRow rows = 3;
}
// Bulk insert response.
message PostTableDataBulkResponse {
// True if all rows were inserted successfully.
bool success = 1;
// Human-readable message.
string message = 2;
// Per-row responses from the underlying PostTableData logic, in request order.
repeated PostTableDataResponse responses = 3;
}
message BeginTableDataImportRequest {
string profile_name = 1;
}
@@ -230,7 +189,12 @@ message BeginTableDataImportResponse {
message StageTableDataImportRequest {
string import_id = 1;
string table_name = 2;
repeated PostTableDataBulkRow rows = 3;
repeated TableDataImportRow rows = 3;
}
message TableDataImportRow {
// Required. Data payload for one staged row.
map<string, google.protobuf.Value> data = 1;
}
message StageTableDataImportResponse {