South migrations and MariaDB

If you’re working on a Django project along with other members of your team and you’re using MariaDB (while the others are using MySQL) you’re gonna have a bad time. Everytime you’ll run migrations generated on a machine with other database than yours you’ll get a strange exception and Google wouldn’t give you too many hopes about solving it.

The exception, django.db.transaction.TransactionManagementError: Transaction managed block ended with pending COMMIT/ROLLBACK is caused by leave_transaction_management method in django/db/backends/ and its source seems to be an incompatibility between MariaDB and MySQL (even if the former is just a fork of the other one).

So you want a fix? I couldn’t find any, but I fixed this by compiling MySQL from AUR (I’m using Manjaro, which is based on Arch Linux). Even if it’s not really a solution maybe you’re coming here from Google and maybe this will help you to solve your issue: Arch/Manjaro uses MariaDB and South seems to not like it very much.

  • simion

    Fresh install of manjaro (with maria db).
    Tried to migrate on an existing project, same issue.

    So i guess they fucked something up in the latest version of MariaDB, because I used MariaDb with south, and worked fine.

    Same solution worked for me too, compile mysql from aur.

    yaourt -S mysql

  • Ovidiu Nițan

    I think this happens only when migrations were generated on a machine with MySQL, but I’m not entirely sure.

  • EK

    In my case, it was caused by missing stats tables in mysql schema in my MariaDB install:

    I had to manually create mysql.table_stats, mysql.column_stats, and mysql.index_stats.