refactor: Use BQ procedular query for EntityAggregationGenerator - #699
Open
SandeepTuniki wants to merge 4 commits into
Open
refactor: Use BQ procedular query for EntityAggregationGenerator#699SandeepTuniki wants to merge 4 commits into
SandeepTuniki wants to merge 4 commits into
Conversation
…ry procedural script
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 1 medium |
| CodeStyle | 2 minor |
🟢 Metrics -54 complexity
Metric Results Complexity -54
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the entity aggregation generation process by migrating dynamic SQL building logic from Python into a cohesive BigQuery procedural SQL script. It also introduces query parameterization via QueryJobConfig to securely inject variables and adds corresponding unit tests. The feedback highlights that the _parse_constraints method is no longer used and should be removed as dead code.
SandeepTuniki
marked this pull request as ready for review
July 31, 2026 07:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a purely refactoring PR. No functionality changes, or bug fixes.
This PR refactors the entity aggregation SQL query. Presently the query is constructed through several python helpers as small snippets, and then combined together. But it's hard to logically follow the query's order and flow due to python's loops and conditions. So I refactored it to take advantage of BQ's native procedural features (i.e; variables, conditions, loops, and temp functions). Now the query is linear and easy to follow.