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

'nautobot-server dumpdata' isn't working #1784

Closed
TheRealBecks opened this issue May 18, 2022 · 1 comment · Fixed by #1786
Closed

'nautobot-server dumpdata' isn't working #1784

TheRealBecks opened this issue May 18, 2022 · 1 comment · Fixed by #1786
Assignees
Labels
type: bug Something isn't working as expected

Comments

@TheRealBecks
Copy link
Contributor

Environment

  • Python version: 3.8.10
  • Nautobot version: 1.3.4
  • OS: Ubuntu 20.04

Steps to Reproduce

Follow the standard installation process for an Ubuntu 20.04 server:

  1. https://nautobot.readthedocs.io/en/stable/installation/ubuntu/
  2. https://nautobot.readthedocs.io/en/stable/installation/nautobot/
  3. https://nautobot.readthedocs.io/en/stable/installation/services/
  4. https://nautobot.readthedocs.io/en/stable/installation/http-server/
  5. Open the browser and check that Nautobot is working --> Yes, works!
  6. Try to create a backup https://nautobot.readthedocs.io/en/latest/administration/nautobot-server/#dumpdata --> Traceback

Expected Behavior

A json dump file will be created.

Observed Behavior

Traceback:

$ nautobot-server dumpdata \
>   --natural-foreign \
>   --natural-primary \
>   --exclude contenttypes \
>   --exclude auth.permission \
>   --exclude extras.job \
>   --format json \
>   --indent 2 \
>   --traceback  > nautobot_dump.json
Traceback (most recent call last):
  File "/opt/nautobot/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/nautobot/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/opt/nautobot/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/opt/nautobot/lib/python3.8/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/opt/nautobot/lib/python3.8/site-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.ProgrammingError: (1146, "Table 'nautobot.django_rq_queue' doesn't exist")

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 <module>
    sys.exit(main())
  File "/opt/nautobot/lib/python3.8/site-packages/nautobot/core/cli.py", line 54, in main
    run_app(
  File "/opt/nautobot/lib/python3.8/site-packages/nautobot/core/runner/runner.py", line 266, in run_app
    management.execute_from_command_line([runner_name, command] + command_args)
  File "/opt/nautobot/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/nautobot/lib/python3.8/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.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/nautobot/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/opt/nautobot/lib/python3.8/site-packages/django/core/management/commands/dumpdata.py", line 232, in handle
    serializers.serialize(
  File "/opt/nautobot/lib/python3.8/site-packages/django/core/serializers/__init__.py", line 129, in serialize
    s.serialize(queryset, **options)
  File "/opt/nautobot/lib/python3.8/site-packages/django/core/serializers/base.py", line 90, in serialize
    for count, obj in enumerate(queryset, start=1):
  File "/opt/nautobot/lib/python3.8/site-packages/django/core/management/commands/dumpdata.py", line 191, in get_objects
    yield from queryset.iterator()
  File "/opt/nautobot/lib/python3.8/site-packages/django/db/models/query.py", line 353, in _iterator
    yield from self._iterable_class(self, chunked_fetch=use_chunked_fetch, chunk_size=chunk_size)
  File "/opt/nautobot/lib/python3.8/site-packages/django/db/models/query.py", line 51, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/opt/nautobot/lib/python3.8/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
    cursor.execute(sql, params)
  File "/opt/nautobot/lib/python3.8/site-packages/cacheops/transaction.py", line 97, in execute
    result = self._no_monkey.execute(self, sql, params)
  File "/opt/nautobot/lib/python3.8/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/opt/nautobot/lib/python3.8/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/opt/nautobot/lib/python3.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/nautobot/lib/python3.8/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.8/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/nautobot/lib/python3.8/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/opt/nautobot/lib/python3.8/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/opt/nautobot/lib/python3.8/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/opt/nautobot/lib/python3.8/site-packages/MySQLdb/connections.py", line 254, in query
    _mysql.connection.query(self, query)
django.db.utils.ProgrammingError: (1146, "Table 'nautobot.django_rq_queue' doesn't exist")

=> django.db.utils.ProgrammingError: (1146, "Table 'nautobot.django_rq_queue' doesn't exist")

Nautobot has been installed with Celery, but not RQ, because RQ has been deprecated in Nautobot.

@bryanculver
Copy link
Member

Thanks for the report @TheRealBecks!

Looks like we need to update our docs (extras.job should be included now) but django-rq@2.5.0 introduced an unmanaged model called Queue.

We will be updating our documentation (and our invoke command) but in the mean time, pass --exclude django_rq as well remove --exclude extras.job.

Before

root@e8a0d24ad588:/source# nautobot-server dumpdata --exclude extras.job --indent 4 --output db_output.json --format jsonCommandError: Unable to serialize database: relation "django_rq_queue" does not exist
LINE 1: SELECT COUNT(*) AS "__count" FROM "django_rq_queue"

After

root@e8a0d24ad588:/source# nautobot-server dumpdata --exclude django_rq --indent 4 --output db_output.json --format json
[...........................................................................]

@bryanculver bryanculver added the type: bug Something isn't working as expected label May 18, 2022
bryanculver added a commit that referenced this issue May 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants