Python’s SQLAlchemy vs Other ORMs[转发 7] 比较结论
Comparison Between Python ORMs
For each Python ORM presented in this article, we are going to list their pros and cons here:
SQLObject
Pros:
- Adopted the easy-to-understand ActiveRecord pattern
- A relatively small codebase
Cons:
- Naming of methods and classes follow Java's camelCase style
- Does not support database sessions to isolate unit of work
Storm
Pros:
- A clean and lightweight API leading to short learning curve and long-term maintainability
- Does not need special class constructors, nor imperative base classes
Cons:
- Forcing the programmer to write manual table-creation DDL statements instead of automatically deriving it from the model class
- Contributors of Storm have to give their contributions' copyrights to Canonical Ltd.
Django's ORM
Pros:
- Easy-to-use with a short learning curve
- Tightly integrated with Django to make it the de-factor standard when dealing with databases in Django
Cons:
- Does not handle complex queries very well; forcing the developer to go back to raw SQL
- Tightly integrated with Django; making it hard to use outside of a Django context
peewee
Pros:
- A Django-ish API; making it easy-to-use
- A lightweight implementation; making it easy to integrate with any web framework
Cons:
- Does not support automatic schema migrations
- Many-to-Many queries are not intuitive to write
SQLAlchemy
Pros:
- Enterprise-level APIs; making the code robust and adaptable
- Flexible design; making it painless to write complex queries
Cons:
- The Unit-of-work concept is not common
- A heavyweight API; leading to a long learning curve
PonyORM
Pros:
- A very convenient syntax for writing queries
- Automatic query optimization
- Simplified setup and usage
Cons:
- Not designed to process hundreds of thousands or millions of records simultaneously
Summary and Tips
Compared to other ORMs, SQLAlchemy stands out in its focus on the unit-of-work concept which is prevalent whenever you write SQLAlchemy code. The DBSession concept might be hard to understand and use correctly initially, but later you will appreciate the additional complexity which reduces accidental database commit-timing-related bugs to almost zero. Dealing with multiple databases in SQLAlchemy can be tricky since each DB session is confined to one database connection. However, this kind of limitation is actually a good thing since it forces you to think hard about the interaction between multiple databases and make it easier to debug database interaction code.
In the future articles, we are going to fully explore more advanced use cases of SQLAlchemy to truly grasp its immensely powerful APIs.
Python’s SQLAlchemy vs Other ORMs[转发 7] 比较结论的更多相关文章
- Python’s SQLAlchemy vs Other ORMs[转发 6]SQLAlchemy
SQLAlchemy SQLAlchemy is an open source SQL toolkit and ORM for the Python programming language rele ...
- Python’s SQLAlchemy vs Other ORMs[转发 0]
原文地址:http://pythoncentral.io/sqlalchemy-vs-orms/ Overview of Python ORMs As a wonderful language, Py ...
- Python’s SQLAlchemy vs Other ORMs[转发 3]Django's ORM
Django's ORM Django is a free and open source web application framework whose ORM is built tightly i ...
- Python’s SQLAlchemy vs Other ORMs[转发 2]Storm
Storm Storm is a Python ORM that maps objects between one or more databases and Python. It allows de ...
- Python’s SQLAlchemy vs Other ORMs[转发 1]SQLObject
SQLObject SQLObject is a Python ORM that maps objects between a SQL database and Python. It is becom ...
- Python’s SQLAlchemy vs Other ORMs[转发 4]peewee
peewee peewee is a small, expressive ORM. Compared to other ORMs, peewee focuses on the principal of ...
- Python’s SQLAlchemy vs Other ORMs[转发 5] PonyORM
PonyORM PonyORM allows you to query the database using Python generators. These generators are trans ...
- 基于Python的SQLAlchemy的操作
安装 在Python使用SQLAlchemy的首要前提是安装相应的模块,当然作为python的优势,可以到python安装目录下的scripts下,同时按住shift+加上鼠标左键,从而在菜单中打开命 ...
- SQLAlchemy(1) -- Python的SQLAlchemy和ORM
Python的SQLAlchemy和ORM(object-relational mapping:对象关系映射) web编程中有一项常规任务就是创建一个有效的后台数据库.以前,程序员是通过写sql语句, ...
随机推荐
- iOS_SourceTree忽略CocoaPods文件
原文作者:iOS_MingXing 原文地址(CSDN):http://blog.csdn.net/ios_mingxing/article/details/51487344 (有更改) 忽略文件内容 ...
- 数据库为什么要用B+树结构--MySQL索引结构的实现
原理: http://blog.csdn.net/cangchen/article/details/44818485 http://blog.csdn.net/kennyrose/article/de ...
- 常用SQL总结
数据库知识总结一.数据库服务器设置1,查看数据库服务器编码 show variables like 'character%';2,设置数据库服务器编码 set character_set_ ...
- Mysql查询重复记录
第一步 使用group by 和 having cout 查找重复字段 SELECT t1.`order_book_id` FROM `quant_stock_info` t1 GROUP BY t1 ...
- 20160712001 SQL server R2 更名
use mastergoselect @@servername;select serverproperty('servername') sp_dropserver 'BPM-SERVER'gosp_a ...
- linux开启telnet
windows客户端如果通过cmd窗口连接到远程linux服务器,可以使用telnet: centos系统默认telnet 23端口是关闭的. 服务器本地使用nmap ip地址 -p 23 查看tel ...
- Java程序员们最常犯的10个错误
将数组转化为一个列表时,程序员们经常这样做: List<String> list = Arrays.asList(arr); Arrays.asList()会返回一个ArrayList对象 ...
- ognl.OgnlException: target is null for setProperty(null, "emailTypeNo", [Ljava.lang.String;@1513fd0)
[com.opensymphony.xwork2.ognl.OgnlValueStack] - Error setting expression 'emaiTypeDto.emailTypeNo' w ...
- placeholder右对齐的写法,兼容性比较高的一种方法
placeholder右对齐的写法,如果你不考虑移动端的话,完全可以使用text-align:right,不过如果考虑移动端的话,在有一些手机上,即使你写了text-align:right,place ...
- 。i节点
http://blog.csdn.net/feiyinzilgd/article/details/5609157 linux中,文件查找不是通过文件名称来查找的.实际上是通过i节点来实现文件的查找定 ...