-
Notifications
You must be signed in to change notification settings - Fork 47
Migrate episode queries to SQLAlchemy #4973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: nishad/sqlalchemy-migration
Are you sure you want to change the base?
Migrate episode queries to SQLAlchemy #4973
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
a4f9c98 to
5fe8ccc
Compare
24f1d7d to
19c4a42
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4f9c98716
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| await session.flush() | ||
| return id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit episode inserts before leaving session
record_episode only calls flush() and returns; with_db/db_session() never commits, so the AsyncSession will roll back when the context exits. This means bulk uploads and episode inserts appear to succeed but nothing is persisted unless the caller commits (the stats route doesn’t). Add an explicit await session.commit() (or wrap in a transaction that commits) before returning to avoid losing writes.
Useful? React with 👍 / 👎.
19c4a42 to
afc9c59
Compare
5fe8ccc to
2348b66
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
afc9c59 to
9d4cd17
Compare
2348b66 to
85cbe40
Compare
- Update Episode model with missing fields (data_uri, primary_pv_id, thumbnail_url, eval_task_id) - Add EpisodeTag model - Create queries/episode_queries.py with record_episode and get_episodes - Update stats_routes.py to use new episode queries - Move EpisodeWithTags model to episode_queries.py Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
9d4cd17 to
fa7f5de
Compare
85cbe40 to
0efd8de
Compare

Summary
models/episodes.pywith Episode and EpisodeTag SQLModel modelsqueries/episode_queries.pywith SQLAlchemy query functionsroutes/stats_routes.pyto use the new query moduleEpisodeReplay,EpisodeWithTags,record_episode,get_episodes)Part of stack to migrate app_backend from raw SQL to SQLAlchemy.