Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocationType matching query does not exist. Foreign key violation for table dcim:locationtype #191

Open
angelsollaperez opened this issue Nov 28, 2024 · 0 comments · May be fixed by #192
Open

Comments

@angelsollaperez
Copy link

Environment

  • Python version: 3.9
  • Nautobot version: 2.1.3
  • nautobot-netbox-importer version: 2.0.0

Expected Behavior

Import

Observed Behavior

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/nautobot/bin/nautobot-server", line 8, in
sys.exit(main())
File "/opt/nautobot/lib/python3.9/site-packages/nautobot/core/cli/init.py", line 52, in main
run_app(
File "/opt/nautobot/lib/python3.9/site-packages/nautobot/core/runner/runner.py", line 297, in run_app
management.execute_from_command_line([runner_name, command, *command_args])
File "/opt/nautobot/lib/python3.9/site-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/opt/nautobot/lib/python3.9/site-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/nautobot/lib/python3.9/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/nautobot/lib/python3.9/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/opt/nautobot/lib/python3.9/site-packages/nautobot_netbox_importer/management/commands/import_netbox.py", line 94, in handle
adapter.import_to_nautobot()
File "/opt/nautobot/lib/python3.9/site-packages/nautobot_netbox_importer/diffsync/adapters/netbox.py", line 95, in import_to_nautobot
self._atomic_import()
File "/usr/lib/python3.9/contextlib.py", line 79, in inner
return func(*args, **kwds)
File "/opt/nautobot/lib/python3.9/site-packages/django/db/transaction.py", line 246, in exit
connection.commit()
File "/opt/nautobot/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner
return func(*args, **kwargs)
File "/opt/nautobot/lib/python3.9/site-packages/django/db/backends/base/base.py", line 266, in commit
self._commit()
File "/opt/nautobot/lib/python3.9/site-packages/django/db/backends/base/base.py", line 242, in _commit
return self.connection.commit()
File "/opt/nautobot/lib/python3.9/site-packages/django/db/utils.py", line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/nautobot/lib/python3.9/site-packages/django/db/backends/base/base.py", line 242, in _commit
return self.connection.commit()
django.db.utils.IntegrityError: inserci��n o actualizaci��n en la tabla ��dcim_locationtype�� viola la llave for��nea ��dcim_locationtype_parent_id_023ca1c8_fk_dcim_locationtype_id��
DETAIL: La llave (parent_id)=(b12f97bf-c17a-5604-8d52-310a2359f97c) no est�� presente en la tabla ��dcim_locationtype��.

Steps to Reproduce

1.export data with:
./manage.py dumpdata
--traceback
--format=json
--indent=2
--natural-primary
--natural-foreign
--exclude=extras.ObjectChange
--exclude=extras.Report
--exclude=extras.Script
--exclude=django_rq.Queue
--exclude extras.configcontext
--output=/tmp/netbox_data.json

  1. import command:
    nautobot-server import_netbox --bypass-data-validation --sitegroup-parent-always-region netbox_data.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants