我正在尝试使用dumpdata为数据库生成JSON,该数据库足够大,django需要很长时间才能输出。是否有任何方式只转储一部分字段;说100,用于测试?
I'm trying to use dumpdata to generate JSON for a database that is sufficiently large for django to take a long, long time to output. Is there any way to dump only a subset of the fields; say, 100, for testing?
我正在使用MySQL和Django 1.0。
I'm using MySQL and Django 1.0.
推荐答案第三方django应用, django-test-utils 包含 makefixture 命令实现,基本上是一个更智能的dumpdata。您可以指定要导出的ID范围的精确型号名称(它将跟随相关对象)示例: manage.py makefixture --format = xml --indent = 4 proj.appname.modelname [1:101]> test.xml
A 3rd party django app, django-test-utils contains a makefixture command implementation which is basically a smarter dumpdata. You can specify exact model names with ID ranges to export (and it will follow related objects) Example: manage.py makefixture --format=xml --indent=4 proj.appname.modelname[1:101] > test.xml
更多推荐
使用Django dumpdata转储整个数据的子集?
发布评论