1

I'm trying to migrate my Wagtail application from sqlite3 to PostgreSQL but I'm getting an error saying

Invalid model identifier: 'wagtailsearch.sqliteftsindexentry'

This is while I type in the command:

python manage.py loaddata data.json

I get this error:

Traceback (most recent call last):
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\apps\config.py", line 235, in get_model
    return self.models[model_name.lower()]
KeyError: 'sqliteftsindexentry'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\core\serializers\python.py", line 181, in _get_model 
    return apps.get_model(model_identifier)
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\apps\registry.py", line 213, in get_model
    return app_config.get_model(model_name, require_ready=require_ready)
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\apps\config.py", line 237, in get_model
    raise LookupError(
LookupError: App 'wagtailsearch' doesn't have a 'sqliteftsindexentry' model.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\mdrift\manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\core\management\__init__.py", line 440, in execute   
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\core\management\base.py", line 402, in run_from_argv 
    self.execute(*args, **cmd_options)
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\core\management\base.py", line 448, in execute       
    output = self.handle(*args, **options)
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 102, in handle
    self.loaddata(fixture_labels)
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\core\management\commands\loaddata.py", line 163, in loaddata
    self.load_label(fixture_label)
oad_label
    for obj in objects:
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\core\serializers\json.py", line 70, in Deserializer  
    yield from PythonDeserializer(objects, **options)
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\core\serializers\python.py", line 103, in Deserializer
    Model = _get_model(d["model"])
  File "C:\Users\DELL\Desktop\Mdrift_Wagtail\venv\lib\site-packages\django\core\serializers\python.py", line 183, in _get_model 
    raise base.DeserializationError(
django.core.serializers.base.DeserializationError: Problem installing fixture 'C:\Users\DELL\Desktop\Mdrift_Wagtail\mdrift\data.json': Invalid model identifier: 'wagtailsearch.sqliteftsindexentry'

1 Answer 1

1

The wagtailsearch.sqliteftsindexentry table is used to store indexed data for searching - this differs between databases, so this table doesn't exist on Postgres. You should exclude it from your dumpdata command using the --exclude=wagtailsearch.sqliteftsindexentry option - this will then give you a .json dump you can load into Postgres.

Once you've migrated successfully, run ./manage.py update_index to populate the search index for Postgres.

Sign up to request clarification or add additional context in comments.

1 Comment

Also worth excluding wagtailsearch.IndexEntry as this caused me issues.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.