Note that there are some explanatory texts on larger screens.

plurals
  1. POmysql exception when synchronizing db with django's manage.py script
    primarykey
    data
    text
    <p>I am relatively new to django. I have defined my db schema and validated it with no errors (manage.py validate reports 0 errors found).</p> <p>Yet when I run ./manage.py syncdb</p> <p>I get the following stack trace:</p> <pre><code>Creating table demo_foobar_one Creating table demo_foobar_two &lt;snip&gt;...&lt;/snip&gt; Traceback (most recent call last): File "manage.py", line 11, in &lt;module&gt; execute_manager(settings) File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/usr/local/lib/python2.6/dist-packages/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 191, in run_from_argv self.execute(*args, **options.__dict__) File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 218, in execute output = self.handle(*args, **options) File "/usr/local/lib/python2.6/dist-packages/django/core/management/base.py", line 347, in handle return self.handle_noargs(**options) File "/usr/local/lib/python2.6/dist-packages/django/core/management/commands/syncdb.py", line 103, in handle_noargs emit_post_sync_signal(created_models, verbosity, interactive, db) File "/usr/local/lib/python2.6/dist-packages/django/core/management/sql.py", line 185, in emit_post_sync_signal interactive=interactive, db=db) File "/usr/local/lib/python2.6/dist-packages/django/dispatch/dispatcher.py", line 162, in send response = receiver(signal=self, sender=sender, **named) File "/usr/local/lib/python2.6/dist-packages/django/contrib/auth/management/__init__.py", line 28, in create_permissions defaults={'name': name, 'content_type': ctype}) File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py", line 135, in get_or_create return self.get_query_set().get_or_create(**kwargs) File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 373, in get_or_create obj.save(force_insert=True, using=self.db) File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 435, in save self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "/usr/local/lib/python2.6/dist-packages/django/db/models/base.py", line 528, in save_base result = manager._insert(values, return_id=update_pk, using=using) File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py", line 195, in _insert return insert_query(self.model, values, **kwargs) File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 1479, in insert_query return query.get_compiler(using=using).execute_sql(return_id) File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py", line 783, in execute_sql cursor = super(SQLInsertCompiler, self).execute_sql(None) File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py", line 727, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python2.6/dist-packages/django/db/backends/util.py", line 15, in execute return self.cursor.execute(sql, params) File "/usr/local/lib/python2.6/dist-packages/django/db/backends/mysql/base.py", line 86, in execute return self.cursor.execute(query, args) File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3-py2.6-linux-i686.egg/MySQLdb/cursors.py", line 176, in execute if not self._defer_warnings: self._warning_check() File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3-py2.6-linux-i686.egg/MySQLdb/cursors.py", line 92, in _warning_check warn(w[-1], self.Warning, 3) _mysql_exceptions.Warning: Data truncated for column 'name' at row 1 </code></pre> <p>I have checked (and double checked) my table schema. All name field are CharField type with maximum length = 64. The backend db I am using is MySQL, so I am sure that indexes can be created for strings of length 64.</p> <p>What could be causing this error (I suspect it is a misleading error message - even though its coming from the db itself)...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload