Questions tagged [dumpdata]

`django-admin.py dumpdata` is a command you could use to output to standard output all data in the database associated with the named application(s) in a Django powered website.

To see detailed information about django-admin.py dumpdata see the Django docs.

52 questions
4
votes
1 answer

Python Django: Use dumpdata for single model with m2m field and mySql

I have a model Lecture with some m2m fields in it, which I would like to dump using dumpdata. But whenever I call python manage.py dumpdata cms.lecture I get the following error CommandError: Unable to serialize database: 'NoneType' object has no…
Magda
  • 1,218
  • 3
  • 14
  • 31
3
votes
1 answer

IntegrityError: (1062, "Duplicate entry '3-add_author' for key 2")

Database is MySQL. I use the django.contrib.auth. Here is all the info: manage.py dumpdata auth > my_auth.json --natural --exclude contenttypes Then I deleted the entire database (drop database my_database), and created a new database (create…
Yuanzhong Deng
  • 218
  • 3
  • 12
3
votes
1 answer

how to Django dumpdata nested models in yaml

So I have this awesome Django app which gives me satisfaction and such. But now the problem, I want to use dumpdata (or something that does the same) to export a model with a nested other model in yaml format. Lets say I have two models, Project and…
Igoranze
  • 1,506
  • 13
  • 35
3
votes
1 answer

How to dumpdata from django-tenant-schemas?

I am trying to use manage.py dumpdata on my app's model but I am not able to see the json data in my dump file as I am using the django-tenant-schemas app to manage models for various clients. Is there any solution to dumpdata related to specific…
Shashishekhar Hasabnis
  • 1,636
  • 1
  • 15
  • 36
3
votes
0 answers

django 1.6 dumpdata generates naive datetime even USE_TZ=True

I am using the fixtures generated from dumpdata for unittests. But I am getting warnings about naive datetime used: RuntimeWarning: DateTimeField Entry.expire received a naive datetime A quick look at fixture shows the datetime is generated in this…
James Lin
  • 25,028
  • 36
  • 133
  • 233
2
votes
2 answers

Django dumpdata prepending additional data to json export

I have a question how to generate dumpdata without this txt on start: [1mLoading .env environment variables...[0m Here is an example: [1mLoading .env environment variables...[0m [ { "model": "auth.permission", "pk": 1, "fields": { …
Keso
  • 71
  • 9
2
votes
1 answer

How do I reference my model in a nested folder structure to dump data in Django 3.2?

I'm using Django 3.2 and Python 3.9. I have this project directory setup + cbapp - manage.py - settings.py + models - __init__.py - crypto_currency.py In my settings.py file, I have INSTALLED_APPS = [ …
Dave
  • 15,639
  • 133
  • 442
  • 830
2
votes
1 answer

Django 2.0 SQLite3 to MySQL loaddata error: "The database backend does not accept 0 as a value for AutoField."

I am attempting to transfer a database from sqlite to mysql. I've googled this error and found Stack Overflow matches, but havent seen how to debug/identify the offending "0 value AutoField" fields. I've tried skirting the issue by dumping/loading…
fish
  • 134
  • 2
  • 9
2
votes
2 answers

Excluding multiple app in django dumpdata using call_command

I'm using call_command to launch a datadump, I would like to exclude multiple apps, so if I was not using call_command, I would do it like the django documentation tell to do it : python manage.py dumpdata --format json -e app1 -e app2 But in…
Pierre.Sassoulas
  • 3,733
  • 3
  • 33
  • 48
2
votes
1 answer

Django dumpdata unable to serialize existing column

I'm getting bit trying to dumpdata from a legacy db i've recently did a reverse engineering using django's inspectdb... Other than this every query works fine. In MySQL workbench the column exists. But when trying to export the data I…
tutuca
  • 3,444
  • 6
  • 32
  • 54
2
votes
1 answer

Django: How to include pk when to export Geojson using dumpdata?

I am using Django 'dumpdata' to export database table to Geojson file. $python manage.py dumpdata --format=geojson > test.geojson However, the geojson file does not contain pk (auto incremented integer). Is there any way to export the pk to the…
MaxHeap
  • 1,138
  • 2
  • 11
  • 20
2
votes
2 answers

Django loaddata command on cygwin returns an error when installing fixtures (SQLite3 database)

I've updated cygwin and python on cygwin to 2.7 and now I cannot load any json files to the database using the loaddata management command in Django. (Using SQLite3 as a database backend) It works for a fixture that has only one instance of data. If…
johnny
  • 165
  • 1
  • 7
2
votes
1 answer

Django dumpdata by date

Is there a way or any modules available to do dumpdata of all models filtered by date? For example, between a range of dates or the dates greater|lesser than the given. limiting-the-amount-of-fixtures-in-django-dumpdata deals with the ID and also…
Babu
  • 2,548
  • 3
  • 30
  • 47
2
votes
1 answer

Why can't I step into the debugger with 'dumpdata' management command?

I am trying to determine why I can't use a debugger when I call: python manage.py dumpdata --indent=2 > forum/fixtures/initial_data.json' I've put the following statements in the management command code: import pdb; pdb.set_trace() # I also tried…
BryanWheelock
  • 12,146
  • 18
  • 64
  • 109
1
vote
1 answer

Django dumpdata-loaddata error serializing custom class: ' Syntax error near "F" '

I'm trying to create a set of fixtures from my database using the dumpdata command provided by Django. I want to be able to load these fixtures using the loaddata command. One of the Models I'm trying to dump has a custom field: particularly, I'm…
jorgmo02
  • 41
  • 7