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 for mysql migration errors out #2193

Closed
sirtux opened this issue Aug 12, 2022 · 2 comments · Fixed by #2194
Closed

nautobot-server dumpdata for mysql migration errors out #2193

sirtux opened this issue Aug 12, 2022 · 2 comments · Fixed by #2194

Comments

@sirtux
Copy link
Contributor

sirtux commented Aug 12, 2022

Environment

  • Python version: 3.10.4
  • Nautobot version: 1.3.10

Steps to Reproduce

  1. Read https://nautobot.readthedocs.io/en/latest/installation/migrating-from-postgresql/
  2. Run
nautobot-server dumpdata \
    --natural-foreign \
    --natural-primary \
    --exclude contenttypes \
    --exclude auth.permission \
    --format json \
    --indent 2 \
    --traceback \
    > nautobot_dump.json

Expected Behavior

A full json file is written

Observed Behavior

nautobot@dbvm:/tmp$ nautobot-server dumpdata \
    --natural-foreign \
    --natural-primary \
    --exclude contenttypes \
    --exclude auth.permission \
    --format json \
    --indent 2 \
    --traceback \
    > nautobot_dump.json
Traceback (most recent call last):
  File "/opt/nautobot/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/nautobot/lib/python3.10/site-packages/django_prometheus/db/common.py", line 71, in execute
    return super().execute(*args, **kwargs)
psycopg2.errors.UndefinedTable: relation "django_rq_queue" does not exist
LINE 1: ... WITH HOLD FOR SELECT "django_rq_queue"."id" FROM "django_rq...
                                                             ^


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

Traceback (most recent call last):
  File "/opt/nautobot/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1175, in execute_sql
    cursor.execute(sql, params)
  File "/opt/nautobot/lib/python3.10/site-packages/cacheops/transaction.py", line 97, in execute
    result = self._no_monkey.execute(self, sql, params)
  File "/opt/nautobot/lib/python3.10/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.10/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/opt/nautobot/lib/python3.10/site-packages/django/db/backends/utils.py", line 79, in _execute
    with self.db.wrap_database_errors:
  File "/opt/nautobot/lib/python3.10/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.10/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/opt/nautobot/lib/python3.10/site-packages/django_prometheus/db/common.py", line 71, in execute
    return super().execute(*args, **kwargs)
django.db.utils.ProgrammingError: relation "django_rq_queue" does not exist
LINE 1: ... WITH HOLD FOR SELECT "django_rq_queue"."id" FROM "django_rq...
                                                             ^


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/nautobot/bin/nautobot-server", line 8, in <module>
    sys.exit(main())
  File "/opt/nautobot/lib/python3.10/site-packages/nautobot/core/cli.py", line 54, in main
    run_app(
  File "/opt/nautobot/lib/python3.10/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.10/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/nautobot/lib/python3.10/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.10/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/nautobot/lib/python3.10/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/opt/nautobot/lib/python3.10/site-packages/django/core/management/commands/dumpdata.py", line 232, in handle
    serializers.serialize(
  File "/opt/nautobot/lib/python3.10/site-packages/django/core/serializers/__init__.py", line 129, in serialize
    s.serialize(queryset, **options)
  File "/opt/nautobot/lib/python3.10/site-packages/django/core/serializers/base.py", line 90, in serialize
    for count, obj in enumerate(queryset, start=1):
  File "/opt/nautobot/lib/python3.10/site-packages/django/core/management/commands/dumpdata.py", line 191, in get_objects
    yield from queryset.iterator()
  File "/opt/nautobot/lib/python3.10/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.10/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.10/site-packages/django/db/models/sql/compiler.py", line 1178, in execute_sql
    cursor.close()
psycopg2.errors.InvalidCursorName: cursor "_django_curs_140409228488704_sync_147198" does not exist
@sirtux
Copy link
Contributor Author

sirtux commented Aug 12, 2022

Might be related to #1784,
I'll try the recommendation out from that ticket and report back.

@sirtux
Copy link
Contributor Author

sirtux commented Aug 12, 2022

Yeah, it is the same issue. I'll open a PR for that.

bryanculver added a commit that referenced this issue Aug 13, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant