Задать вопрос

Тел: +7 965 3737 888

399

Просмотров

3

Ответов

streaming dump_data

<p>dumpdata without MemoryErrors, with progress notification. Most of the real work is done by snippets <a href="http://foothold.ru/knowledge/detail/queryset-foreach.html">1400</a> and <a href="http://foothold.ru/knowledge/detail/streaming-serializer.html">1401</a>.</p>
./manage.py dumpdata_stream --format=xml &gt; big_dump.xml

<p>This is basically the stock Django dumpdata with a few modifications. Django devs: it's hard to reuse parts of most Django management commands. A little refactoring could go a long way.</p>

Вопрос полезен? Да0/Нет0
file_4620.py(3.9Кб)
None

Ответы (3):

Ответpcollins:15.04.2010
Ответ полезен? Да0/Нет0

@rage3

To fix the float division error go modify the Queryset Foreach (snippet 1400) file at line 32 where it says return self.cur_idx / ....

put that in a try except ZeroDivisionError block and in the exception handler put return 0

That should fix it and get it working.

Ответwiz:17.11.2009
Ответ полезен? Да0/Нет0

saved my day!

Ответrage3:25.04.2009
Ответ полезен? Да0/Нет0

Some help on how to use the snippets would be neat for newbies. Can I just pack all 3 snippets in one file and overwrite dumpdata.py? I tried, but keep getting this error:

manage.py dumpdata --format=xml > dump.xml

INFO:root:Dumping model [HTML_REMOVED]

INFO:root:qs4e: Getting list of objects

Error: Unable to serialize database: float division