During a new install of Netbox (no existing database), the migration fails with:
Traceback (most recent call last):
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "netbox_data_flows_dataflowgroup" does not exist
LINE 1: ... "netbox_data_flows_dataflowgroup"."tree_id" FROM "netbox_da...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/netbox-3.4.2/netbox/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
utility.execute()
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/core/management/__init__.py", line 440, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/core/management/base.py", line 402, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/core/management/base.py", line 443, in execute
self.check()
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/core/management/base.py", line 475, in check
all_issues = checks.run_checks(
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/core/checks/registry.py", line 88, in run_checks
new_errors = check(app_configs=app_configs, databases=databases)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/core/checks/urls.py", line 14, in check_url_config
return check_resolver(resolver)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/core/checks/urls.py", line 24, in check_resolver
return check_method()
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/urls/resolvers.py", line 494, in check
for pattern in self.url_patterns:
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/utils/functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/urls/resolvers.py", line 715, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/utils/functional.py", line 57, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/opt/netbox-3.4.2/netbox/netbox/urls.py", line 9, in <module>
from extras.plugins.urls import plugin_admin_patterns, plugin_patterns, plugin_api_patterns
File "/opt/netbox-3.4.2/netbox/extras/plugins/urls.py", line 28, in <module>
urlpatterns = import_string(f"{plugin_path}.urls.urlpatterns")
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/utils/module_loading.py", line 30, in import_string
return cached_import(module_path, class_name)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/utils/module_loading.py", line 15, in cached_import
module = import_module(module_path)
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/netbox_data_flows/urls.py", line 5, in <module>
from . import models, views
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/netbox_data_flows/views/__init__.py", line 3, in <module>
from .dataflows import *
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/netbox_data_flows/views/dataflows.py", line 86, in <module>
class DataFlowRuleListView(generic.ObjectListView):
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/netbox_data_flows/views/dataflows.py", line 87, in DataFlowRuleListView
queryset = models.DataFlow.objects.only_enabled()
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/netbox_data_flows/models/dataflows.py", line 37, in only_enabled
enabled_groups = DataFlowGroup.objects.only_disabled().only("pk")
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/netbox_data_flows/models/groups.py", line 23, in only_disabled
return self.filter(
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/mptt/querysets.py", line 22, in get_descendants
return self.model._tree_manager.get_queryset_descendants(self, *args, **kwargs)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/mptt/managers.py", line 200, in get_queryset_descendants
return self._get_queryset_relatives(queryset, "desc", include_self)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/mptt/managers.py", line 144, in _get_queryset_relatives
if not q:
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/models/query.py", line 408, in __bool__
self._fetch_all()
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/models/query.py", line 1867, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/models/query.py", line 87, in __iter__
results = compiler.execute_sql(
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1398, in execute_sql
cursor.execute(sql, params)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/opt/netbox-3.4.2/venv/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "netbox_data_flows_dataflowgroup" does not exist
LINE 1: ... "netbox_data_flows_dataflowgroup"."tree_id" FROM "netbox_da...
^
The cause is DataFlowGroupQuerySet.only_disabled() doing a SQL query before the table is created.
During a new install of Netbox (no existing database), the migration fails with:
The cause is DataFlowGroupQuerySet.only_disabled() doing a SQL query before the table is created.