Commit 66c4c6f3c833615fa7b65121fa028550e298d9d9
1 parent
181d7eb8
Exists in
dev
fix sqlalchemy warning
Problem: After finishing a topic, the function get_question does multiple operations on the database, in the same session. SQLAlchemy was issuing a warning and suggesting using session.no_autoflush. Solution: Added no_autoflush to the session.
Showing
1 changed file
with
1 additions
and
1 deletions
Show diff stats
aprendizations/learnapp.py
| ... | ... | @@ -276,7 +276,7 @@ class Application(): |
| 276 | 276 | date: str = str(student_state.get_topic_date(tid)) |
| 277 | 277 | logger.info('User "%s" finished topic "%s" (level=%.2f)', uid, tid, level) |
| 278 | 278 | |
| 279 | - with Session(self._engine) as session: | |
| 279 | + with Session(self._engine).no_autoflush as session: | |
| 280 | 280 | query = select(StudentTopic) \ |
| 281 | 281 | .where(StudentTopic.student_id == uid) \ |
| 282 | 282 | .where(StudentTopic.topic_id == tid) | ... | ... |