force delete row on django app after migration

Posted by unsorted on Stack Overflow See other posts from Stack Overflow or by unsorted
Published on 2010-06-08T22:49:48Z Indexed on 2010/06/08 22:52 UTC
Read the original article Hit count: 517

Filed under:
|

After a migration with south, I ended up deleting a column. Now the current data in one of my tables is screwed up and I want to delete it, but attempts to delete just result in an error:

>>> d = Degree.objects.all()
>>> d.delete()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Python26\lib\site-packages\django\db\models\query.py", line 440, in d
elete
    for i, obj in izip(xrange(CHUNK_SIZE), del_itr):
  File "C:\Python26\lib\site-packages\django\db\models\query.py", line 106, in _
result_iter
    self._fill_cache()
  File "C:\Python26\lib\site-packages\django\db\models\query.py", line 760, in _
fill_cache
    self._result_cache.append(self._iter.next())
  File "C:\Python26\lib\site-packages\django\db\models\query.py", line 269, in i
terator
    for row in compiler.results_iter():
  File "C:\Python26\lib\site-packages\django\db\models\sql\compiler.py", line 67
2, in results_iter
    for rows in self.execute_sql(MULTI):
  File "C:\Python26\lib\site-packages\django\db\models\sql\compiler.py", line 72
7, in execute_sql
    cursor.execute(sql, params)
  File "C:\Python26\lib\site-packages\django\db\backends\util.py", line 15, in e
xecute
    return self.cursor.execute(sql, params)
  File "C:\Python26\lib\site-packages\django\db\backends\sqlite3\base.py", line
200, in execute
    return Database.Cursor.execute(self, query, params)
DatabaseError: no such column: students_degree.abbrev
>>>

Is there a simple way to just force a delete? Do I drop the table and then rerun manage.py schemamigration to recreate the table in south?

© Stack Overflow or respective owner

Related posts about django

Related posts about django-south