Skip to content

Fixing _update_max_id_per_time for SQLGraph#211

Merged
JoOkuma merged 3 commits intoroyerlab:mainfrom
yfukai:fix_add_node_issue_sql
Nov 24, 2025
Merged

Fixing _update_max_id_per_time for SQLGraph#211
JoOkuma merged 3 commits intoroyerlab:mainfrom
yfukai:fix_add_node_issue_sql

Conversation

@yfukai
Copy link
Copy Markdown
Contributor

@yfukai yfukai commented Nov 21, 2025

Fixing issue with _update_max_id_per_time after saving the SQLite, and test this.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.36%. Comparing base (e87a375) to head (cd33d22).
⚠️ Report is 3 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread src/tracksdata/graph/_sql_graph.py Outdated
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))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the suggestion. I updated the implementation using groupby!

@JoOkuma JoOkuma merged commit cfbe20d into royerlab:main Nov 24, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants