Open
Conversation
baogorek
requested changes
Apr 6, 2026
Collaborator
baogorek
left a comment
There was a problem hiding this comment.
Mostly a "safe, mechanical refactor," but I'm requesting one line be removed (with .unique). Let me know if you want to discuss.
| ), | ||
| ) | ||
| ) | ||
| .unique() |
Collaborator
There was a problem hiding this comment.
Code smell for me. I really don't like deduplication commands unless there's a very good reason for them. From Claude:
The thing is — this query has no .join(). It's a simple select(Stratum).where(...) with an .in_() filter.
There shouldn't be duplicate rows from that. The .unique() is unnecessary here.
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.
Summary
session.query(...)lookups withsession.exec(select(...))in the SOI ETL loadersTesting
UV_PYTHON=3.14 uv run pytest tests/unit/test_etl_irs_soi_overlay.py tests/unit/test_etl_national_targets.py -qUV_PYTHON=3.14 uv run ruff check policyengine_us_data/db/etl_irs_soi.py policyengine_us_data/db/etl_national_targets.py tests/unit/test_etl_national_targets.pyUV_PYTHON=3.14 uv run ruff format --check policyengine_us_data/db/etl_irs_soi.py policyengine_us_data/db/etl_national_targets.py tests/unit/test_etl_national_targets.py