Commit 3af562b
authored
feat: Search within date range in pipeline run API (#130)
### TL;DR
Implemented search within date range in Pipeline Runs.
### What changed?
#### Functional
- API `GET /api/pipeline_runs/`
- Search by date range in `filter_query`. Example query (not URL encoded for example):
```
/api?filter_query={
"and": [{
"time_range": {
"key": "system/pipeline_run.date.created_at",
"start_time": "2024-01-01T00:00:00Z",
"end_time": "2024-02-01T00:00:00Z"
}
}]
}
```
- Valid time ranges:
- Start time only
- End time only
- (Start + End) time
#### Other
- Added timezone handling to convert aware datetimes to naive UTC for database compatibility (i.e. date range search will convert API timezone to UTC because DB datetime is only UTC)
### How to test?
```
uv run pytest tests/test_api_server_sql.py tests/test_filter_query_sql.py
```
The implementation includes comprehensive tests covering:
- Basic time range filtering with start and end times
- Start-only time ranges (no end time)
- Boundary conditions (inclusive start, exclusive end)
- Timezone offset handling (e.g., `+05:30` converted to UTC)
- Negation with `NOT` operator
- Combination with annotation-based filters
- Nested logical operations (`AND`/`OR`)
- Multiple time ranges in the same query
### Why make this change?
- This change enables users to filter pipeline runs by creation date range.
- The implementation properly handles timezone conversions to ensure consistent behavior across different client timezones while maintaining compatibility with the database's naive UTC storage format.1 parent 6fcc19d commit 3af562b
4 files changed
Lines changed: 863 additions & 12 deletions
File tree
- cloud_pipelines_backend
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
105 | 109 | | |
106 | 110 | | |
107 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
| |||
301 | 306 | | |
302 | 307 | | |
303 | 308 | | |
| 309 | + | |
| 310 | + | |
304 | 311 | | |
305 | | - | |
306 | 312 | | |
307 | 313 | | |
308 | 314 | | |
| |||
363 | 369 | | |
364 | 370 | | |
365 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
0 commit comments