feat: add import execution api
This commit is contained in:
@@ -102,3 +102,41 @@ curl -X POST http://127.0.0.1:8080/api/v1/raw-artifacts \
|
||||
```
|
||||
|
||||
同一个 `sha256` 重复登记时,API 返回已有 artifact,并可将新的导入批次关联到该 artifact。
|
||||
|
||||
## API 执行导入
|
||||
|
||||
执行顺序:
|
||||
|
||||
1. 创建或选择数据源。
|
||||
2. 创建 `audit.ingestion_runs` 批次。
|
||||
3. 使用文件指纹登记 `audit.raw_artifacts`。
|
||||
4. 调用执行接口写入 `raw.import_rows` 和对应 `silver` 表。
|
||||
|
||||
```bash
|
||||
curl -X POST http://127.0.0.1:8080/api/v1/imports/execute \
|
||||
-H 'content-type: application/json' \
|
||||
-d '{
|
||||
"template_name": "area_monthly_metrics",
|
||||
"run_id": 1,
|
||||
"raw_artifact_id": 1,
|
||||
"rows": [
|
||||
{
|
||||
"area_id": "qiantan",
|
||||
"month": "2026-05",
|
||||
"transaction_count": "93",
|
||||
"transaction_price_psm": "122500",
|
||||
"listing_count": "380",
|
||||
"listing_price_psm": "126500",
|
||||
"median_days_on_market": "53",
|
||||
"rent_price_psm": "192",
|
||||
"new_supply_units": "60",
|
||||
"land_residential_gfa_sqm": "0",
|
||||
"mortgage_rate_pct": "3.35",
|
||||
"policy_signal": "1",
|
||||
"source": "manual_research"
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
|
||||
当前执行接口支持 `area_monthly_metrics` 和 `neighborhood_monthly_metrics`。校验失败时不会写入业务表,并会把导入批次标记为 `failed`。
|
||||
|
||||
Reference in New Issue
Block a user