manage.py full export complains about missing relation #11858

Closed
opened 2025-12-29 21:50:47 +01:00 by adam · 4 comments
Owner

Originally created by @rainerduffner on GitHub (Nov 21, 2025).

NetBox Edition

NetBox Community

NetBox Version

v4.4.2

Python Version

3.12

Steps to Reproduce

time python3 manage.py dumpdata --indent 2 --natural-foreign --natural-primary > /root/full_netbox_backup.json
CommandError: Unable to serialize database: relation "django_rq_queue" does not exist
LINE 1: ... WITH HOLD FOR SELECT "django_rq_queue"."id" FROM "django_rq...
^

Expected Behavior

I guess it should work without error

Observed Behavior

see above

Originally created by @rainerduffner on GitHub (Nov 21, 2025). ### NetBox Edition NetBox Community ### NetBox Version v4.4.2 ### Python Version 3.12 ### Steps to Reproduce time python3 manage.py dumpdata --indent 2 --natural-foreign --natural-primary > /root/full_netbox_backup.json CommandError: Unable to serialize database: relation "django_rq_queue" does not exist LINE 1: ... WITH HOLD FOR SELECT "django_rq_queue"."id" FROM "django_rq... ^ ### Expected Behavior I guess it should work without error ### Observed Behavior see above
adam added the type: bugnetbox labels 2025-12-29 21:50:47 +01:00
adam closed this issue 2025-12-29 21:50:48 +01:00
Author
Owner

@jnovinger commented on GitHub (Nov 21, 2025):

@rainerduffner, for the moment you can use this modified command, that I found in https://github.com/netbox-community/netbox-demo-data/pull/7:

manage.py dumpdata --indent 2 --natural-foreign --natural-primary -e django_rq -e core.job

Note that I needed to also include -e core.job for my dev instance (v4.4.6), since I had Job objects saved that had datetime objects in the log_entries field that weren't being serialized correctly. You may or may not need that yourself.

You might also be able to get away with -e django_rq.queue, which only excludes that relation explicitly, rather than all of the django_rq_* relations as my example above does.

@jnovinger commented on GitHub (Nov 21, 2025): @rainerduffner, for the moment you can use this modified command, that I found in https://github.com/netbox-community/netbox-demo-data/pull/7: ```shell manage.py dumpdata --indent 2 --natural-foreign --natural-primary -e django_rq -e core.job ``` Note that I needed to also include `-e core.job` for my dev instance (v4.4.6), since I had `Job` objects saved that had datetime objects in the `log_entries` field that weren't being serialized correctly. You may or may not need that yourself. You might also be able to get away with `-e django_rq.queue`, which only excludes that relation explicitly, rather than all of the `django_rq_*` relations as my example above does.
Author
Owner

@jnovinger commented on GitHub (Nov 21, 2025):

Ah, if I had continued down the list of my search result I would have also seen that this is actually a known bug (#631) in the django-rq project.

@jnovinger commented on GitHub (Nov 21, 2025): Ah, if I had continued down the list of my search result I would have also seen that this is actually a [known bug (#631)](https://github.com/rq/django-rq/issues/631) in the django-rq project.
Author
Owner

@jeremystretch commented on GitHub (Nov 21, 2025):

The dumpdata management command is a Django internal tool and not something we officially support as part of NetBox. I don't think there's any action for us to take here.

@jeremystretch commented on GitHub (Nov 21, 2025): The `dumpdata` management command is a Django internal tool and not something we officially support as part of NetBox. I don't think there's any action for us to take here.
Author
Owner

@rainerduffner commented on GitHub (Nov 22, 2025):

OK, thanks.
I admit this is something that an LLM produced when questioned about the possibility to do partial exports to import in a dev-instance.

I've tried this:

$ python3 manage.py dumpdata --indent 2 --natural-foreign --natural-primary -e django_rq > /tmp/full_netbox_backup.json
CommandError: Unable to serialize database: Object of type datetime is not JSON serializable

So, I guess it's really not made for that purpose...

@rainerduffner commented on GitHub (Nov 22, 2025): OK, thanks. I admit this is something that an LLM produced when questioned about the possibility to do partial exports to import in a dev-instance. I've tried this: $ python3 manage.py dumpdata --indent 2 --natural-foreign --natural-primary -e django_rq > /tmp/full_netbox_backup.json CommandError: Unable to serialize database: Object of type datetime is not JSON serializable So, I guess it's really not made for that purpose...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11858