Почему не удаётся подключиться к БД через Orator ORM?

Здравствуйте. Подскажите, почему Orator ORM пытается подключиться к базе данных от имени root?
Stack trace
File "~/api/controllers/Domains.py", line 78, in add
userid = Users.where('api_token', usertoken).first().id
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 59, in __getattr__
query = cls.query()
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 1815, in query
return cls().new_query()
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 122, in __init__
self._boot_if_not_booted()
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 149, in _boot_if_not_booted
klass._boot()
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 167, in _boot
cls._boot_mixins()
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 185, in _boot_mixins
if hasattr(mixin, method):
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 59, in __getattr__
query = cls.query()
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 1815, in query
return cls().new_query()
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 1782, in new_query
builder = self.new_query_without_scopes()
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 1808, in new_query_without_scopes
self._new_base_query_builder()
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 1836, in _new_base_query_builder
conn = self.get_connection()
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 2767, in get_connection
return self.resolve_connection(self.__connection__)
File "/usr/local/lib/python3.6/dist-packages/orator/orm/model.py", line 2801, in resolve_connection
return cls.__resolver.connection(connection)
File "/usr/local/lib/python3.6/dist-packages/orator/database_manager.py", line 43, in connection
connection = self._make_connection(name)
File "/usr/local/lib/python3.6/dist-packages/orator/database_manager.py", line 132, in _make_connection
return self._factory.make(config, name)
File "/usr/local/lib/python3.6/dist-packages/orator/connectors/connection_factory.py", line 36, in make
return self._create_single_connection(config)
File "/usr/local/lib/python3.6/dist-packages/orator/connectors/connection_factory.py", line 39, in _create_single_connection
conn = self.create_connector(config).connect(config)
File "/usr/local/lib/python3.6/dist-packages/orator/connectors/connector.py", line 39, in connect
self._connection = self._do_connect(config)
File "/usr/local/lib/python3.6/dist-packages/orator/connectors/mysql_connector.py", line 101, in _do_connect
return self.get_api().connect(**self.get_config(config))
File "/usr/local/lib/python3.6/dist-packages/pymysql/__init__.py", line 90, in Connect
return Connection(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 706, in __init__
self.connect()
File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 932, in connect
self._request_authentication()
File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 1152, in _request_authentication
auth_packet = self._read_packet()
File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 1014, in _read_packet
packet.check_error()
File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 393, in check_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.6/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: NO)")

Получаю ошибку pymysql.err.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: NO)")
Хотя в самой модели прописаны иные реквизиты для подключения к БД:
from orator import Model,  DatabaseManager
config = {
    'mysql': {
        'driver': 'mysql',
        'host': 'localhost',
        'database': 'somedb',
        'user': 'someuser',
        'password': 'somepass',
        'prefix': ''
    }
}
db = DatabaseManager(config)
Model.set_connection_resolver(db)


class Users(Model):
    __table__ = 'users'
    __fillable__ = [
        'password',
        'name',
        'email',
        'id',
        'api_token',
        'role',
        'node'
    ]
    __timestamps__ = False
    __primary_key__ = 'unid'
  • Вопрос задан
  • 138 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы