проблема миграции postgresql в sqlite - PullRequest
1 голос
/ 16 мая 2019

Я новичок в postgresql. У меня есть проект django, использующий postgresql. Я хочу переместить мою существующую базу данных в postgresql в sqlite. Для этого я пробовал разные методы, упомянутые на этом форуме, но каждый из них давал мне разные ошибки Наконец, инструмент с именем potgresql-to-sqlite работал с некоторыми незначительными изменениями в файле дампа postgrql. Теперь я могу запустить свое веб-приложение на Django. Но на определенной странице я получаю сообщение об ошибке типа

TechItem 'объект не имеет атрибута' _mi_selection_params_cache '

У меня есть столбец с именем 'mi_selection_params'., Но в моей базе данных нет такого столбца, как '_mi_selection_params_cache'.

Что означает эта ошибка? Где искать код для решения этой проблемы?

Вот трассировка,

    Traceback (most recent call last):
  File "E:\gir\python3.5\lib\site-packages\django\db\models\fields\related_descriptors.py", line 178, in __get__
    rel_obj = getattr(instance, self.cache_name)
AttributeError: 'TechItem' object has no attribute '_mi_selection_params_cache'

Вот код из django related_discriptors.py

def __get__(self, instance, cls=None):
        """
        Get the related instance through the forward relation.

        With the example above, when getting ``child.parent``:

        - ``self`` is the descriptor managing the ``parent`` attribute
        - ``instance`` is the ``child`` instance
        - ``cls`` is the ``Child`` class (we don't need it)
        """
        if instance is None:
            return self

        # The related instance is loaded from the database and then cached in
        # the attribute defined in self.cache_name. It can also be pre-cached
        # by the reverse accessor (ReverseOneToOneDescriptor).
        try:
            rel_obj = getattr(instance, self.cache_name)
        except AttributeError:
            val = self.field.get_local_related_value(instance)
            if None in val:
                rel_obj = None
            else:
                rel_obj = self.get_object(instance)
                # If this is a one-to-one relation, set the reverse accessor
                # cache on the related object to the current instance to avoid
                # an extra SQL query if it's accessed later on.
                if not self.field.remote_field.multiple:
                    setattr(rel_obj, self.field.remote_field.get_cache_name(), instance)
            setattr(instance, self.cache_name, rel_obj)

        if rel_obj is None and not self.field.null:
            raise self.RelatedObjectDoesNotExist(
                "%s has no %s." % (self.field.model.__name__, self.field.name)
            )
        else:
            return rel_obj
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...