Совместим ли Django 3 с MySQL 5.7?

Я запускаю приложение django в Ubuntu, и версия MySQL:

mysql Ver 14.14 Distrib 5.7.34, for Linux (x86_64) using EditLine wrapper

Версия Django - 3.2.5

Но это вызвало ошибку:

 File "/opt/anaconda3/lib/python3.7/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/opt/anaconda3/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/anaconda3/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/opt/anaconda3/lib/python3.7/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/opt/anaconda3/lib/python3.7/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/opt/anaconda3/lib/python3.7/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)

Exception Type: ProgrammingError at /category/python.html
Exception Value: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION (SELECT `blog_article`.`id`, `blog_article`.`created_time`, `blog_article`' at line 1")

Является ли это проблемой совместимости между Django 3 и MySQL 5.7?

Update

Мой сниппет выглядит следующим образом, что, вероятно, вызывает ошибку:

        public_article_list = Article.objects.filter(
        category__name__in=categorynames, status__in=['p', 'g'])
        user = self.request.user
        self_article_list = Article.objects.filter(category__name__in=categorynames,
                                                   type='a', status='i', author_id=user.id)
        article_list = public_article_list.union(self_article_list)
        if user.id:
            registered_view_articles = Article.objects.filter(type='a', status='z')
            article_list = article_list.union(registered_view_articles)
Вернуться на верх