通过MySQLdb进行SQLAlchemy的目的 [英] Purpose of SQLAlchemy over MySQLdb

查看:132
本文介绍了通过MySQLdb进行SQLAlchemy的目的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么人们使用SQLAlchemy代替MySQLdb?它有什么优势?

Why do people use SQLAlchemy instead of MySQLdb? What advantages does it offer?

推荐答案

您不使用SQLAlchemy代替MySQLdb,而是使用SQLAlchemy访问类似MySQLdb,oursql之类的东西(我听到的另一个MySQL驱动程序更好,性能也更好. ),sqlite3模块,psycopg2或您使用的任何其他数据库驱动程序.

You don't use SQLAlchemy instead of MySQLdb—you use SQLAlchemy to access something like MySQLdb, oursql (another MySQL driver that I hear is nicer and has better performance), the sqlite3 module, psycopg2, or whatever other database driver you are using.

ORM(如SQLAlchemy)可帮助抽象出正在使用的数据库的详细信息.这样一来,您就可以避免使用正在使用的数据库系统的细节,避免某些时候出现错误的可能性(并引入其他可能性),并且使移植变得微不足道(至少在理论上如此).

An ORM (like SQLAlchemy) helps abstract away the details of the database you are using. This allows you to keep from the miry details of the database system you're using, avoiding the possibility of errors some times (and introducing the possibility of others), and making porting trivial (at least in theory).

这篇关于通过MySQLdb进行SQLAlchemy的目的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆