Commit ad500e6
livestatus-client: accept typed Query objects in the connection API
The typed `cmk.livestatus_client.queries.Query` could not be passed to the
low-level connection methods (`query`, `query_row`, ...): `QueryTypes` only
covered `str | livestatus.Query`, so callers had to wrap it in
`livestatus.Query(query)` first.
Add the existing `_SupportsJsonFormat` protocol to `QueryTypes`. The typed
`Query` already satisfies it (it provides `__str__` and
`supports_json_format`), so it can now be handed directly to any connection
method, which normalizes it internally while preserving the query's output
format decision (blob columns stay on the Python format). This avoids a
layer-inverting import of the high-level query builder into the low-level
connection module.
Use this in PredictionQuerier._query_prediction_files, dropping the
`livestatus.Query` wrapper.
CMK-32809
Change-Id: I081257087671400be61e271650d73b64ead7c55b1 parent 51f9869 commit ad500e6
2 files changed
Lines changed: 6 additions & 3 deletions
File tree
- cmk/utils/prediction
- packages/cmk-livestatus-client/cmk/livestatus_client
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
59 | | - | |
| 58 | + | |
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
528 | | - | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
529 | 533 | | |
530 | 534 | | |
531 | 535 | | |
| |||
0 commit comments