作DJANGO ORM时的一些最佳实践

还是国外的正规,都在作DJANGO ORM的解藕化工作了。

外键不用,多对多,一对多,不用。

 

参考URL:

http://scottlobdell.me/2015/01/sql-database-best-practices-django-orm/

==========这个网站有很多DJANGO干货哟=============

The last example really encapsulates most of what I’ve written about.

  • There’s an index for one side of the many to many table based on the query patterns of our use case.
  • There’s no foreign key (I used an integer instead of a foreign key).
  • There’s an abstraction layer for the use case.
  • Database queries are made one table at a time with no table joins or dependent sub-queries.
  • I’m casting QuerySets to lists as soon as I know I want to fetch data from the database.
  • The “gotchas” that you might experience with Django are impossible to stumble upon for another programmer that’s using the new class’s API.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值