2017-08-10 11 views
0

私はフラスコのウェブサイトを持っています。場合によっては、次のエラーが返されることがあります。Flask、SQLAlchemyエラー(無効なトランザクション)

Exception message: Can't reconnect until invalid transaction is rolled back (original cause: InvalidRequestError: Can't reconnect until invalid transaction is rolled back) u'SELECT a_auth2_user.id AS a_auth2_user_id, a_auth2_user.username AS a_auth2_user_username, a_auth2_user.fullname AS a_auth2_user_fullname, a_auth2_user.email AS a_auth2_user_email, a_auth2_user.password AS a_auth2_user_password, a_auth2_user.plain_password AS a_auth2_user_plain_password, a_auth2_user.legacy_password AS a_auth2_user_legacy_password, a_auth2_user.active AS a_auth2_user_active, a_auth2_user.is_admin AS a_auth2_user_is_admin, a_auth2_user.phone AS a_auth2_user_phone, a_auth2_user.last_activity AS a_auth2_user_last_activity \nFROM a_auth2_user \nWHERE a_auth2_user.id = %s \n LIMIT %s' [immutabledict({})]

このエラーは「時々」返されます。時々それはうまく動作します。 メモリ問題のようなものですか?どうすれば修正できますか?

答えて

0

無効なトランザクションがある場合は、以前のコミットにいくつかの例外がある可能性があるので、セッションをロールバックする必要があります。

try: 
    transaction.commit() 
except Exception, e: 
    session.rollback() 
関連する問題