Repository navigation
Adding the runs_jobs_detail_aggregation endpoint - #243
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
…regated-query' into feature/116-adding-dashboard-aggregated-query
oto-macenauer-absa
left a comment
There was a problem hiding this comment.
solid piece of work, thx, just minor comments and questions
lsulak
left a comment
There was a problem hiding this comment.
Reviewed most of it. Good job, but I noticed several things to improve. Also, when do you anticipate we should remove the stats named queries? They are basically a duplicates of the other ones in named_queries.sql - my recommendation is either now & a ticket (probably preferable to keep PRs small scoped)
| return _build_json_response( | ||
| 200, | ||
| { | ||
| "success": True, |
There was a problem hiding this comment.
hmm this is a bit weird contract, success is quite visible from the status code, and then also status code is there twice. Is there any situation when it differentiates?
There was a problem hiding this comment.
I completely see what you are saying. However this contract was established in the past. And this PR is only a refactor - not creating anything new. So modification in this PR would change the established client contract and that is IMO not a current scope of this task. We can discuss it further and create from this comment a follow-up GH issue. What do you think?
There was a problem hiding this comment.
Agree, then maybe create a ticket to revisit this, and do it (if ever) outside of this PR
There was a problem hiding this comment.
The issue based on this conversation was created here: #256
| timeline_daily_sql_key: str | ||
|
|
||
|
|
||
| SUPPORTED_AGGREGATION_QUERIES: dict[str, AggregationQuery] = { |
There was a problem hiding this comment.
hmm this really looks comlicated, the whole file. Isn't there already some native aiosql capability to list supported queries? Also, maybe it makes sense to split the existing queries into 2 files, i.e. 2 categories - like job detail type queries and then analytical / aggregation like queries
Update: I could not find it quickly in the aiosql docs so I just opened aiosql code and found this as a public property that you can hopefully use: available_queries against your query, for example when you are doing this: aiosql.from_path(_SQL_DIR, "psycopg2"))
There was a problem hiding this comment.
Also the naming is not really explanatory. This is a typical SW development process - we started with named queries, then created data structures and algorithms (loading process, validation etc) around that, and then there was a new type, more analytical queries, and now there are new data structures and algorithms around that - but basically everything is a named query, right? So the names are not descriptive enough. This is technical debt. Not to mention that stats.sql are now duplicated.
I think that this PR is a good time to reduce tech debt, not add much more to it
There was a problem hiding this comment.
I tried to make naming conventions better to current query state. See following commit: 4efa108.
I am also implementing suggested approach of aiosql available_queries. Thanks for raising that! But I want to have that in separate PR - I am about to build that on top of this PR. Following PR: #251. The solution is robust and solves several issues that we would face in the future, but for current solution maybe too complex. Share your thoughts please on the added link there.
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class AggregationQueryParams: |
There was a problem hiding this comment.
At some point, we may want to support filtering by tenant and source (and possibly other parameters as requirements emerge). If it’s a simple change, we can add it within this PR... otherwise, it can done in a separate PR.
There was a problem hiding this comment.
Please see my response to similar comment from @lsulak: #243 (comment). The implementation is done in commit: d17382a.
I completely feel, what you are saying or what I feel from the review points. I tried to make the solution more "friendly" by renaming the queries as described in the comment responses. But you are also suggesting some things, that are more on a refactor level or ready to be deeper discussion. If we want to start some better refactored, modifying some contracts etc lets move to follow-up issue and close this one (if possible and good enough) as a v1. Please share your thoughts. |
Overview
This pull request introduces support for window-wide aggregation queries alongside existing paginated named queries, with a focus on the new
runs_jobs_detail_aggregationendpoint. It updates the OpenAPI spec, handler validation, query registry, and reader logic to support aggregation queries with a new response shape, and introduces new data models for typed aggregation results.Release Notes
Related
#116
https://github.com/absa-group/cps-eventbus-gateway/pull/191