I've got an old site running Django 1.1 with a postgress backend. I'm moving
it to Django 1.3, with MySQL. I dumped all the old data with:
$ python manage.py dumpdata --indent 2 > materia-dump.2012-04-06.json
I created a brand new MySQL database and ran syncdb, then tried to import the
data with
$ python manage.py loaddata materia-dump.2012-04-06.json
But I get complaints about duplicate keys:
> Problem installing fixture '/home/roy/materia-dump.2012-04-06.json':
> Traceback (most recent call last):
> File
> "/usr/lib/pymodules/python2.6/django/core/management/commands/loaddata.py",
> line 174, in handle
> obj.save(using=using)
> File "/usr/lib/pymodules/python2.6/django/core/serializers/base.py", line
> 165, in save
> models.Model.save_base(self.object, using=using, raw=True)
> File "/usr/lib/pymodules/python2.6/django/db/models/base.py", line 526, in
> save_base
> rows = manager.using(using).filter(pk=pk_val)._update(values)
> File "/usr/lib/pymodules/python2.6/django/db/models/query.py", line 491, in
> _update
> return query.get_compiler(self.db).execute_sql(None)
> File "/usr/lib/pymodules/python2.6/django/db/models/sql/compiler.py", line
> 869, in execute_sql
> cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
> File "/usr/lib/pymodules/python2.6/django/db/models/sql/compiler.py", line
> 735, in execute_sql
> cursor.execute(sql, params)
> File "/usr/lib/pymodules/python2.6/django/db/backends/util.py", line 34, in
> execute
> return self.cursor.execute(sql, params)
> File "/usr/lib/pymodules/python2.6/django/db/backends/mysql/base.py", line
> 86, in execute
> return self.cursor.execute(query, args)
> File "/usr/lib/pymodules/python2.6/MySQLdb/cursors.py", line 166, in execute
> self.errorhandler(self, exc, value)
> File "/usr/lib/pymodules/python2.6/MySQLdb/connections.py", line 35, in
> defaulterrorhandler
> raise errorclass, errorvalue
> IntegrityError: (1062, "Duplicate entry 'photologue-gallery' for key
> 'app_label'")
Looking at the json output, I don't see any duplicates. I've got:
{
"pk": 9,
"model": "contenttypes.contenttype",
"fields": {
"model": "gallery",
"name": "gallery",
"app_label": "photologue"
}
},
but that's the only entry for name = "gallery", app_label = "photologue". Any
idea what I'm doing wrong?
---
Roy Smith
[email protected]
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.