cursor.fetchone() returns None but row in the database exists Okay, db.autocommit(True) solved my problem.