开发者

Connect to mysql [duplicate]

开发者 https://www.devze.com 2023-02-01 20:06 出处:网络
This question already has answers here: Closed 10 years ago. Possible Duplicate: How do I connect to a MySQL开发者_运维百科 Database in Python?
This question already has answers here: Closed 10 years ago.

Possible Duplicate:

How do I connect to a MySQL开发者_运维百科 Database in Python?

There is a way to connect python with a mysql db? I found something, but seems to is only for windows and I'm working with linux.


Use MySQL-Python.

I also strongly advise having a look at SQLAlchemy, an ORM that allows you to write once for all major sql's including MySQL. It's a bit more complex, but the flexibility is a serious advantage.


You can use the MySQL-Python package. Search your disto's package database first before installing from source (you probably already have it there). Be aware that all database packages do (our should) adhere to the Python DB API. This provides a standardized interface to all databases.

If you are comfortable with writing SQL, then that should suffice. If you prefer to query and define data in pure python I would also recommend SQLAlchemy.

0

精彩评论

暂无评论...
验证码 换一张
取 消