On Fri, Sep 25, 2009 at 3:25 AM, skunkwerk <skunkw...@gmail.com> wrote:
>
> Hi,
>   I created a database dump using the 'dumpdata' command, and when I
> but am getting this error when I add the line:
> fixtures = ['test_fixture-24.09.09.json'] to my TestCase class:
>
> Problem installing fixture '//ites/bdl/match/trunk/python/bdl_site/
> match/fixtures/test_fixture-24.09.09.json': Traceback (most recent
> call last):
>  File "/Library/Python/2.5/site-packages/django/core/management/
> commands/loaddata.py", line 119, in handle
>    obj.save()
>  File "/Library/Python/2.5/site-packages/django/core/serializers/
> base.py", line 163, in save
>    models.Model.save_base(self.object, raw=True)
>  File "/Library/Python/2.5/site-packages/django/db/models/base.py",
> line 383, in save_base
>    result = manager._insert(values, return_id=update_pk)
>  File "/Library/Python/2.5/site-packages/django/db/models/
> manager.py", line 138, in _insert
>    return insert_query(self.model, values, **kwargs)
>  File "/Library/Python/2.5/site-packages/django/db/models/query.py",
> line 894, in insert_query
>    return query.execute_sql(return_id)
>  File "/Library/Python/2.5/site-packages/django/db/models/sql/
> subqueries.py", line 309, in execute_sql
>    cursor = super(InsertQuery, self).execute_sql(None)
>  File "/Library/Python/2.5/site-packages/django/db/models/sql/
> query.py", line 1734, in execute_sql
>    cursor.execute(sql, params)
>  File "/Library/Python/2.5/site-packages/django/db/backends/mysql/
> base.py", line 83, in execute
>    return self.cursor.execute(query, args)
>  File "build/bdist.macosx-10.5-i386/egg/MySQLdb/cursors.py", line
> 168, in execute
>    if not self._defer_warnings: self._warning_check()
>  File "build/bdist.macosx-10.5-i386/egg/MySQLdb/cursors.py", line 82,
> in _warning_check
>    warn(w[-1], self.Warning, 3)
>  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/warnings.py", line 62, in warn
>    globals)
>  File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/
> python2.5/warnings.py", line 102, in warn_explicit
>    raise message
> Warning: Data truncated for column 'title' at row 1
>
> but when I call loaddata directly, it works just fine:
> django-admin.py loaddata test_fixture-24.09.09.json
> Installing json fixture 'test_fixture-24.09.09' from '/Users/imran/
> Sites/bdl/match/trunk/python/bdl_site/match/fixtures'.
> Installed 5365 object(s) from 1 fixture(s)
>
> how can i fix the loading of the test suite fixture?

The error you are seeing is valid - the content you are trying to
store is longer than the column you are trying to store it in.
However, before we can fix the problem, you need to understand the
cause. At a guess, one of two things is happening:

* You're using an different database backend for the test suite then
for normal operation. You're seeing MySQL errors caused by having
content that exceeds the allowed column length; however, if you are
using SQLite normally, you won't see any errors as SQLite doesn't
complain about excessively long content. If this is the cause, then
the solution is to find the object with a "title" field that has a
length greater than the model definition allows, and fix that fixture
entry. Doing a bisection search of your fixture will be the easiest
way to find the offending record(s).

* More likely, you've modified the table definition on the live site,
but not on the Django definition. Alternatively, you've made a change
to the model definition reducing the allowed length of a CharField.
The original (live site) table has been synchronized with the old,
longer column; the test database is created using the current model
definition. If this is the cause, there are two possible solutions:
  - modify the model definition to reflect the original column length,
  - modify the live table definition to reflect the new column length
(and regenerate the fixture).

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to