반응형
MariaDB 10.5.8에서 Django 이행 실행 시 문제
mysql 데이터베이스(버전 5.7.26-29-31.37-log - SELECT VERSION()의 출력)에서 mariadb(버전 10.5.8-MariaDB-log - SELECT VERSION()의 출력)로의 이행을 시도하고 있습니다.
또한 mariadb는 버전 3.0에서 공식적으로 지원되기 때문에 버전 2.2에서 버전 3.1.5로 django를 보고 업데이트했습니다.이것으로 mysqlclient 라이브러리도 2.0.3으로 업데이트했습니다.
그러나 서버에서 "migrate" 명령어가 실행되면 새 DB: 10진수에서 실행할 때 실패하고 이 오류가 발생합니다.Invalid Operation: [<클래스 '10진수']Conversion Syntax'>]
스택 트레이스를 다음에 나타냅니다.
DEBUG (0.008) SELECT @@SQL_AUTO_IS_NULL; args=None
DEBUG (0.007) SHOW FULL TABLES; args=None
DEBUG (0.007) SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; args=None
DEBUG (0.008) SHOW FULL TABLES; args=None
OUT Operations to perform:
OUT Apply all migrations: admin, auth, contenttypes, my_auth, essay, multichoice, quiz, sessions, sites, social_django, true_false
OUT Running pre-migrate handlers for application auth
OUT Running pre-migrate handlers for application contenttypes
OUT Running pre-migrate handlers for application sessions
OUT Running pre-migrate handlers for application sites
OUT Running pre-migrate handlers for application admin
OUT Running pre-migrate handlers for application quiz
OUT Running pre-migrate handlers for application multichoice
OUT Running pre-migrate handlers for application true_false
OUT Running pre-migrate handlers for application essay
OUT Running pre-migrate handlers for application my_auth
OUT Running pre-migrate handlers for application social_django
OUT Running migrations:
ERR [2021-01-06 09:32:31,188] (utils) DEBUG (0.007) SHOW FULL TABLES; args=None
ERR [2021-01-06 09:32:31,196] (utils) DEBUG (0.007) None; args=None
ERR Traceback (most recent call last):
ERR File "runapp.py", line 90, in <module>
ERR migrate()
ERR File "runapp.py", line 29, in migrate
ERR call_command("migrate", "-v 3", "--traceback")
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 168, in call_command
ERR return command.execute(*args, **defaults)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/core/management/base.py", line 371, in execute
ERR output = self.handle(*args, **options)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/core/management/base.py", line 85, in wrapped
ERR res = handle_func(*args, **kwargs)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 245, in handle
ERR fake_initial=fake_initial,
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/migrations/executor.py", line 91, in migrate
ERR self.recorder.ensure_schema()
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/migrations/recorder.py", line 68, in ensure_schema
ERR editor.create_model(self.Migration)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 322, in create_model
ERR sql, params = self.table_sql(model)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 159, in table_sql
ERR definition, extra_params = self.column_sql(model, field)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 212, in column_sql
ERR db_params = field.db_parameters(connection=self.connection)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 718, in db_parameters
ERR check_string = self.db_check(connection)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 666, in db_check
ERR return connection.data_type_check_constraints[self.get_internal_type()] % data
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
ERR res = instance.__dict__[self.name] = self.func(instance)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 344, in data_type_check_constraints
ERR if self.features.supports_column_check_constraints:
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
ERR res = instance.__dict__[self.name] = self.func(instance)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/mysql/features.py", line 104, in supports_column_check_constraints
ERR if self.connection.mysql_is_mariadb:
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
ERR res = instance.__dict__[self.name] = self.func(instance)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 372, in mysql_is_mariadb
ERR return 'mariadb' in self.mysql_server_info.lower()
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/utils/functional.py", line 48, in __get__
ERR res = instance.__dict__[self.name] = self.func(instance)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 360, in mysql_server_info
ERR cursor.execute('SELECT VERSION()')
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 98, in execute
ERR return super().execute(sql, params)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 66, in execute
ERR return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
ERR return executor(sql, params, many, context)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 82, in _execute
ERR return self.cursor.execute(sql)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 73, in execute
ERR return self.cursor.execute(query, args)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/MySQLdb/cursors.py", line 206, in execute
ERR res = self._query(query)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/MySQLdb/cursors.py", line 321, in _query
ERR self._post_get_result()
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/MySQLdb/cursors.py", line 355, in _post_get_result
ERR self._rows = self._fetch_row(0)
ERR File "/home/vcap/deps/0/python/lib/python3.6/site-packages/MySQLdb/cursors.py", line 328, in _fetch_row
ERR return self._result.fetch_row(size, self._fetch_type)
ERR decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
뭐가 문제인지 아는 사람 있어요?SELECT VERSION() 호출이 이 변환 오류를 트리거하는 것처럼 보입니다.
감사합니다!
결국 드라이버/DB 커넥터를 교환하는 데 도움이 되었습니다.
종속성에서 mysqlclient 제거
종속성에 mysql-sysql-sysql-sysql~=8.0을 추가합니다(요건에 삽입).txt)
settings.py 파일에서 다음과 같이 데이터베이스 구성을 조정합니다.
DATABASES = { 'default': { 'ENGINE': 'mysql.connector.django', 'NAME': 'db_name', 'USER': 'db_user', 'PASSWORD': 'db_password', 'HOST': 'db_host', 'PORT': 3306, 'OPTIONS': { 'autocommit': True, 'raise_on_warnings': True, }, } }
이게 도움이 됐으면 좋겠네요!
언급URL : https://stackoverflow.com/questions/65592745/issue-when-running-django-migrations-on-mariadb-10-5-8
반응형
'source' 카테고리의 다른 글
MySQL JOIN과 LEFT JOIN의 차이점 (0) | 2022.11.28 |
---|---|
Java8 스트림 요소를 기존 목록에 추가하는 방법 (0) | 2022.11.28 |
스레드 사용 시 예외가 발생합니다.sleep(x) 또는 wait() (0) | 2022.11.28 |
스탠드아론 mariaDB 서버에 비해 galera의 퍼포먼스가 매우 나쁘다 (0) | 2022.11.28 |
휴지 상태 오류: 동일한 식별자 값을 가진 다른 개체가 세션에 이미 연결되어 있습니다. (0) | 2022.11.28 |