Django Dumpdata Error Unable To Serialize Database
I'm getting an error when I'm trying to dump data to a JSON fixture in Djanog 1.2.1 on my live server. On the live server it's running MySQL Server version 5.0.77 and I imported a lot of data to my tables using the phpMyAdmin interface. The website works fine and Django admin responds as normal. But when I try and actually dump the data of the application that corresponds to the tables I get this error: $ python manage.py dumpdata -indent=2 gigs fixtures/gigs100914.json /usr/local/lib/python2.6/site-packages/MySQLdb/init.py:34: DeprecationWarning: the sets module is deprecated from sets import ImmutableSet Error: Unable to serialize database: Location matching query does not exist.
I once ran in a similar problem where the error message was as mesmerizing as yours. The cause was a lack of memory on my server. It seems that generating dumps in json is quite memory expensive. I had only 60meg of memory (at djangohosting.ch) and it was not enough to get a dump for a mysql DB for which the mysql dump was only 1meg.
This is basically the stock Django dumpdata with a few modifications. Django devs: it's hard to reuse parts of most Django management commands. Get_querysets(), stream=sys.stdout, indent=indent) except Exception, e: if show_traceback: raise raise CommandError('Unable to serialize database:%s'.
I was able to find out by watching the python process hit the 60meg limit using the top command in a second command line while running manage.py dumpdata in a first one. My solution: get the mysql dump and then load it on my desktop pc, before generating the json dump. That said, for backup purposes, the mysql dumps are enough. The command to get a mysql dump is the following: mysqldump -p password -u username databasename dumpfilename.sql That said, your problem could be completely different.
You should really look at every table that has a foreign key to your Location table, and check if there is no field pointing to a previously deleted location. Unfortunately MySQL is very bad at maintaining Referential integrity, and you cannot count on it.
Error: Unable to serialize database: User matching query does not exist. I knew this might not work out since I was dealing with a legacy database, but the resolution is quite simple. First I had to narrow it down to which app was causing this. Naturally I assumed it was one of the two apps I had, either common or restaurant. So I ran:./manage.py dumpdata common and./manage.py dumpdata restaurant. The latter had no problem whatsoever. This made sense, since my common application was the only one that made any reference to a User.
By looking in my models.py for that application, I narrowed it down to my Profile object. Sure enough, commenting it out meant I could get my data. It ended up being a foreign key mismatch between the profile and user tables. Since this is legacy data, this mismatch made sense. A simple SELECT id,userid FROM profile WHERE userid NOT IN (SELECT id FROM authuser) gave me a list of bad profiles. Removing them allowed me to create my Django fixtures.
Django Dumpdata Error Unable To Serialize Database In Excel
Django Community 12153 people, 170 countries, 4036 packages and projects. Django community: Django Q&A RSS This page, updated regularly, aggregates Django Q&A from the Django community. Logtail dumpdata Issue. If you use python manage.py dumpdata, be sure to add the -exclude=logtail flag to your command or you'll be presented with a: CommandError: Unable to serialize database: relation 'djangologtaillog' does not exist LINE 1: SELECT 'djangologtaillog'.' Id' FROM 'djangologtaillog' O. Traceback when you run the.