StoreStructuredDataActivity.Execute
Purpose
Сохраняет документы из временного structured JSON-файла в generic JSONB-хранилище terry.structured_data_documents.
Код: internal/worker/loader/structured_data.go
Behavior
- Резолвит current loader config по
data_source_id. - Читает
processor_settings.structured_data. - Если
enabled != true, возвращаетstructured_data.status=skipped. - Если временный structured-файл отсутствует, возвращает
skipped; для processor path reason будетwaiting_for_processor. - Читает JSON из raw object storage по
temporary_structured_data.file_uid. - Выбирает документы по
record_path. - Коррелирует поля по
data_source_fields. - Upsert-ит документы по
(structured_file_uid, record_index). - После успешного upsert удаляет только temporary structured file, если
delete_temporary_fileне равенfalse.
Field Correlation
data_source_fields:
structured_field_name: имя поля в correlatedfields.source_path: dot-path внутри записи; если пустой, используетсяstructured_field_name.required: отсутствие значения фейлит activity non-retryable ошибкой.
record_path выбирает массив записей, например items[]. Пустой record_path означает root object как один документ или root array как набор документов.
Config Example
{
"structured_data": {
"enabled": true,
"record_path": "items[]",
"delete_temporary_file": true,
"data_source_fields": [
{"structured_field_name": "currency_code", "source_path": "char_code", "required": true},
{"structured_field_name": "rate", "source_path": "value", "required": true}
]
}
}