Document current outlook schema behavior
This commit is contained in:
@@ -23,7 +23,7 @@ Events are mapped only for canonical weather schemas:
|
||||
- `weather.forecast_discussion.v1`
|
||||
- `weather.weather_story.v1`
|
||||
- `weather.alert.v1`
|
||||
- `weather.outlook.v1`
|
||||
- `weather.outlook.v2`
|
||||
|
||||
Unsupported schemas produce no writes for this sink. Mapped events are inserted
|
||||
transactionally. Inserts use ordinary `INSERT`; duplicate primary keys fail the
|
||||
@@ -59,6 +59,7 @@ Parent tables store the feed event envelope:
|
||||
| `alert_references` | `run_event_id`, `alert_index`, `reference_index` | `as_of` |
|
||||
| `outlook_runs` | `event_id` | `as_of` |
|
||||
| `outlooks` | `run_event_id`, `outlook_index` | `as_of` |
|
||||
| `outlook_discussions` | `run_event_id`, `discussion_index` | `as_of` |
|
||||
|
||||
## Table Contract
|
||||
|
||||
@@ -408,6 +409,7 @@ Indexes:
|
||||
| `as_of` | `TIMESTAMPTZ` | no | `payload.asOf` |
|
||||
| `issued_at` | `TIMESTAMPTZ` | yes | `payload.issuedAt` |
|
||||
| `outlook_count` | `INTEGER` | no | `len(payload.outlooks)` |
|
||||
| `discussion_count` | `INTEGER` | no | `len(payload.discussions)` |
|
||||
|
||||
### `outlooks`
|
||||
|
||||
@@ -442,14 +444,36 @@ Indexes:
|
||||
| `issued_at` | `TIMESTAMPTZ` | no | `payload.outlooks[].issuedAt` |
|
||||
| `expires_at` | `TIMESTAMPTZ` | no | `payload.outlooks[].expiresAt` |
|
||||
| `forecaster` | `TEXT` | yes | `payload.outlooks[].forecaster` |
|
||||
| `headline` | `TEXT` | yes | `payload.outlooks[].headline` |
|
||||
| `summary` | `TEXT` | yes | `payload.outlooks[].summary` |
|
||||
| `discussion` | `TEXT` | yes | `payload.outlooks[].discussion` |
|
||||
| `source_url` | `TEXT` | yes | `payload.outlooks[].sourceUrl` |
|
||||
| `image_url` | `TEXT` | yes | `payload.outlooks[].imageUrl` |
|
||||
| `contains_location` | `BOOLEAN` | no | `payload.outlooks[].containsLocation` |
|
||||
| `geometry_json` | `TEXT` | no | Compact JSON from `payload.outlooks[].geometry` |
|
||||
|
||||
### `outlook_discussions`
|
||||
|
||||
Primary key: `run_event_id`, `discussion_index`
|
||||
|
||||
Prune column: `as_of`
|
||||
|
||||
Foreign key: `run_event_id` references `outlook_runs(event_id)` with cascade
|
||||
delete.
|
||||
|
||||
Indexes:
|
||||
|
||||
- `idx_wf_outlook_discussions_day_as_of` on `day`, `as_of`
|
||||
- unique `idx_wf_outlook_discussions_run_day` on `run_event_id`, `day`
|
||||
|
||||
| Column | Type | Null | Source |
|
||||
|---|---|:---:|---|
|
||||
| `run_event_id` | `TEXT REFERENCES outlook_runs(event_id) ON DELETE CASCADE` | no | Parent event ID. |
|
||||
| `discussion_index` | `INTEGER` | no | `payload.discussions[]` index. |
|
||||
| `as_of` | `TIMESTAMPTZ` | no | Parent `payload.asOf` |
|
||||
| `day` | `INTEGER` | no | `payload.discussions[].day` |
|
||||
| `headline` | `TEXT` | yes | `payload.discussions[].headline` |
|
||||
| `summary` | `TEXT` | yes | `payload.discussions[].summary` |
|
||||
| `discussion` | `TEXT` | yes | `payload.discussions[].discussion` |
|
||||
| `updated_at` | `TIMESTAMPTZ` | yes | `payload.discussions[].updatedAt` |
|
||||
|
||||
## Retention
|
||||
|
||||
When sink param `prune` is set, every successful write transaction deletes rows
|
||||
@@ -472,5 +496,6 @@ binary does not provide CLI commands for them.
|
||||
- `WeatherAlertRun`: read `alert_runs`, join `alerts` by `run_event_id` ordered
|
||||
by `alert_index`, then join `alert_references` by `run_event_id` and
|
||||
`alert_index` ordered by `reference_index`.
|
||||
- `WeatherOutlookRun`: read `outlook_runs`, then join `outlooks` by
|
||||
`run_event_id` ordered by `outlook_index`.
|
||||
- `WeatherOutlookRun`: read `outlook_runs`, join `outlooks` by `run_event_id`
|
||||
ordered by `outlook_index`, then join `outlook_discussions` by
|
||||
`run_event_id` ordered by `discussion_index`.
|
||||
|
||||
Reference in New Issue
Block a user