Fixing _update_max_id_per_time for SQLGraph#211
Merged
JoOkuma merged 3 commits intoroyerlab:mainfrom Nov 24, 2025
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #211 +/- ##
==========================================
+ Coverage 88.29% 88.36% +0.07%
==========================================
Files 53 54 +1
Lines 3809 3843 +34
Branches 661 663 +2
==========================================
+ Hits 3363 3396 +33
- Misses 266 267 +1
Partials 180 180 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
JoOkuma
requested changes
Nov 21, 2025
Comment on lines
+573
to
+574
| for t in session.scalars(sa.select(self.Node.t).distinct()): | ||
| max_id = session.scalar(sa.select(sa.func.max(self.Node.node_id)).where(self.Node.t == t)) |
Member
There was a problem hiding this comment.
Hey @yfukai, I didn't realize at the time, but I think we can remove the loop. Would a groupby operation work?
stmt = (
select(self.Node.t, func.max(self.Node.node_id))
.group_by(self.Node.t)
)
Contributor
Author
There was a problem hiding this comment.
Hi, thanks for the suggestion. I updated the implementation using groupby!
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.
Fixing issue with
_update_max_id_per_timeafter saving the SQLite, and test this.