MySQL 和 Python 不匹配
我知道面向对象技术和关系技术之间的不匹配,
但我不知道MySQL和Python之间的不匹配,以及其他工具(不仅仅是ORM)来处理这个问题,在后一篇文章中遗漏了。
提问:
- MySQL和Python之间的问题是如何处理的?
- App Engine 的非 SQL 是否能让 Python 更好地协同工作?
- 是否有一些通用工具(例如 ORM)来处理不匹配问题?
- 处理问题的非标准方法有哪些?
- 你能说nonSQL是一个让Python的面向对象世界与关系世界相匹配的工具吗? 或者说新的设计是否完全避免了这个问题?
I know the mismatch between Object Oriented Technology and the Relational Technology, generally here.
But I do not know the mismatch between MySQL and Python, and other tools, not just ORMs, to deal with the issue, missing in the latter article.
Questions:
- How is the problem dealt between MySQL and Python?
- Does App Engine's non-SQL makes Python work better together?
- Are there some general tools, perhaps ORM, to deal with mismatches?
- What are non-standard ways to deal with the problem?
- Could you say that the nonSQL is a tool to make the object-oriented world of Python match the Relational world? Or does the new design totally avoid the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ORM 是使 Python 的面向对象世界与 MySQL 的关系世界相匹配的标准解决方案。
至少有 3 个流行的 ORM 组件。
SQLAlchemy
SQLObject
Django 的 ORM。
ORM is the standard solution for making the object-oriented world of Python match the Relational world of MySQL.
There are at least 3 popular ORM components.
SQLAlchemy
SQLObject
Django's ORM.
正如在 comp.lang.python 上曾经说过的那样,ORM 就像吗啡——如果你真的受伤了,它可以减轻你的痛苦,但如果你经常使用它,你最终会遇到很大的问题。
在关系数据库和对象模型之间构建相对较低级别的接口并不难。 事后将自动化 ORM 映射迁移到新设计是极其困难的。 只有不成熟的程序员才会尝试简化并不困难的事情,而不考虑可能出现的极其困难的后果。
谷歌应用程序引擎 mini-rdb-with-some-restrictions-removed 很好,因为它
只自动执行极其简单的事情并迫使您考虑表格布局
不要假装这一切都可以自动完成。
As was once said on comp.lang.python ORM's are like morphine -- it can save you pain if you are really hurting, but if you use it regularly you will end up with really big problems.
It's not hard to build relatively low level interfaces between a relational database and an object model. It's extremely hard to migrate an automated ORM mapping to a new design after the fact. Only immature programmers try to simplify things that are not hard without looking ahead to the possible consequences that are extremely hard.
The google app engine mini-rdb-with-some-restrictions-removed is nice because it
only automates extremely simple stuff and forces you to think about the table layout
without pretending that it can all be done automatically.