fix: fix CRUD types returns and reduce DB queries when cleanup statuses#331
Draft
bolinocroustibat wants to merge 8 commits intomainfrom
Draft
fix: fix CRUD types returns and reduce DB queries when cleanup statuses#331bolinocroustibat wants to merge 8 commits intomainfrom
bolinocroustibat wants to merge 8 commits intomainfrom
Conversation
f888ce2 to
7154d09
Compare
# Conflicts: # udata_hydra/utils/errors.py
9ebd9a8 to
2d5d343
Compare
2d5d343 to
48594ed
Compare
maudetes
reviewed
Sep 25, 2025
Contributor
maudetes
left a comment
There was a problem hiding this comment.
I did not look a the code in details, but it seems to me that we're adding some complexity here when the for a less structured type?
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.
We have some consistency issues with types and (non-blocking) type errors in the code. To make the code more consistent and avoid type warnings, we suggest the following rules:
• In the business logic, checks should be handled as
dictrather thanRecordwhenever possible, since working with native Python objects greatly simplifies the manipulation logic.• Since
asyncpgreturnsRecordobjects when querying the DB, CRUD methods should returnRecordtypes whenever possible so they remain “pure” CRUD.This PR updates the code to follow these rules, and introduces a
dictoption toCheckCRUD methods avoid repeating the patternrecord = await Check.get()followed bycheck = dict(record)multiple times, in line with the DRY principle.We also add
# type: ignorewhen callingCheckclass methods usingas_dict, as the IDE may not infer the type correctly for methods that can return multiple types.Resource.clean_up_statuses()by using a single DB request instead of a loop.