Django的不错扩展

nicedjango的Python项目详细描述


nicedjango

不错的django工具

Build StatusCoverallsDocumentation StatusRequirements StatusDownloadsLatest VersionSupported Python versionsSupported Python implementationsDevelopment StatusWheel StatusEgg StatusDownload formatLicense

仅对所有对象及其相关对象的所需模型数据进行选择性转储和加载 一个或多个查询集的对象。

这是由

  • getting a graph of all relations between models,
  • getting all pks first in chunks,
  • dump them in an order that enables correct loading.

# show model graph parts that would be dumped and those which not:
# example for query model a1.A with relation to child a1.B(A)
./manage.py dump_graph -p -q a -r a.b
    a1-a:
               a1-a.b          to child            a1-b.pk
       excludes:
               a1-a.f          to foreign          a1-f.a
     a1-b:
               a1-b.pk         to parent           a1-a.pk
       excludes:
               a1-b.c          to child            a1-c.pk
               a1-b.e          to child            a1-e.pk

# dump all objects from a1.models.A.objects.filter() with relation a.b as compact yaml:
./manage.py dump_graph -f dump.yaml -s compact_yaml -q a.filter(pk__in=(1,2)) -r a.b
    - a1-a: [pk]
     - [1]
     - [2]
     - a1-b: [pk]
     - [2]

# load back the dumped dump.yaml
./manage.py load_graph -f dump.yaml -s compact_yaml

# by default serializing into compact csv files is enabled:
mkdir dump_folder
./manage.py dump_graph -f dump_folder -q a.filter(pk__in=(1,2)) -r a.b
#results in two files under dump_folder:
# a1-a.csv:
 a1-a:pk
 1
 2
# and a1-b.csv:
 a1-b:pk
 2

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java WebClient请求级别超时抛出名为default onErrorDropped的运算符   java JAXB外部绑定文件错误   Freemarker中的java转义宏参数值   java正在同步来自不同对象{已编辑}的线程   java如何在另一个类上更新活动中的元素   java Hibernate连接查询   java可以使用Apache Crunch创建类似于图形的数据结构吗?   java在JLabel的开头加上3个点   java 安卓应用程序显示线程错误   java@RequestBody在Spring中总是空的   java Android异步任务永远不会结束   具有多个属性的java Jaxws枚举   java中的安卓 Stripe InvalidRequestException   多线程java。util。非多线程程序中的ConcurrentModificationException   Minecraft Java插件如何删除HashMap中存储的所有块   空Java字符串的大小   从AJP连接器请求检索Shibboleth属性的java   oracle11g将Java类文件加载到Oracle数据库