使用Django dumpdata转储整个数据的子集?

编程入门 行业动态 更新时间:2024-10-10 19:25:39
本文介绍了使用Django dumpdata转储整个数据的子集?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试使用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转储整个数据的子集?

本文发布于:2023-10-27 23:58:47,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1534908.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:子集   数据   Django   dumpdata

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!