dgilland / sqlservice

The missing SQLAlchemy ORM interface.
https://sqlservice.readthedocs.io
MIT License
179 stars 9 forks source link

A weird session-related error #17

Closed Oliver2213 closed 7 years ago

Oliver2213 commented 7 years ago

I'm using SQLService with flask. When I use a testing database (sqlite), things work normally. When I use my normal database (MySQL), however... This happens.

Sep 24 14:24:20 oliver2213 uwsgi[2052]: OperationalError: (raised as a result of Query-invoked autoflush; consider using
 a session.no_autoflush block if this flush is occurring prematurely) (_mysql_exceptions.OperationalError) (1205, 'Lock
wait timeout exceeded; try restarting transaction') [SQL: u'UPDATE ......

I originally thought this might be an issue caused because the scoped session wasn't bound to a flask context, but after using the example in #3, however... I still get the same result. Is there an option I should be setting in SQLService's config? All this flask route is doing is creating a model instance, populating it, saving it, then retrieving it again. I've tried restarting my UWSGI process, but no luck.

Oliver2213 commented 7 years ago

I figured out why the error I mentioned above happened; it was something in my code, not that of SQLService. Sorry for the issue (I'll close this and if anyone has a similar problem that's really caused by SQLService they can of course reopen).