The error message I got was

Traceback (most recent call last):
  File "./test.py", line 416, in <module>
    startup()
  File "./test.py", line 275, in startup
    writer.save(r,data) 
  File "/home/user/project/test/output.py", line 91, in save
    self.save_doc(r, data, pid)
  File "/home/user/project/test/output.py", line 130, in save_doc
    cursor.execute(dbquery)
  File "/usr/local/lib/python2.6/site-packages/django/db/backends/util.py", line 34, in execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 86, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/lib/python2.6/site-packages/MySQL_python-1.2.3c1-py2.6-linux-x86_64.egg/MySQLdb/cursors.py", line 175, in execute
  File "/usr/local/lib/python2.6/site-packages/MySQL_python-1.2.3c1-py2.6-linux-x86_64.egg/MySQLdb/cursors.py", line 89, in _warning_check
_mysql_exceptions.Warning: Data truncated for column 'url' at row 1

The first thing I was checking is if the URL string is longer than the field length, but it is actually much shorter. Database Design

+----------+-------------------------------------------------------------------+
| Database | Create Database                                                   |
+----------+-------------------------------------------------------------------+
| myurlcol | CREATE DATABASE `myurlcol` /*!40100 DEFAULT CHARACTER SET utf8 */ | 
+----------+-------------------------------------------------------------------+

Table Design

  CREATE TABLE `document` (
  `id` int(11) NOT NULL auto_increment,
  `url` varchar(255) collate utf8_bin NOT NULL,
  `md5` varchar(32) collate utf8_bin NOT NULL,
  `host` varchar(255) collate utf8_bin default NULL,
  `content_sha1` varchar(40) collate utf8_bin NOT NULL,
  `add_date` datetime NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `url` (`url`),
Edit
Report