且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Python将数据加载到Mysql中

更新时间:2023-11-02 12:26:10

是.通常,您要使用的是对象关系映射库.

It is. Typically what you want to do is use an Object-Retlational Mapping library.

在python生态系统中使用最广泛的可能是 SQLAlchemy ,但是发生了很多魔术在其中,因此,如果您想对数据库架构进行更严格的控制,或者正在学习关系数据库,并且希望遵循代码的功能,***使用Canonical的

Probably the most widely used in the python ecosystem is SQLAlchemy, but there is a lot of magic going on in it, so if you want to keep a tighter control on your DB schema, or if you are learning about relational DB's and want to follow along what the code does, you might be better off with something lighter like Canonical's storm.

编辑:刚想添加.使用ORM的原因是,它们提供了一种非常方便的方式来处理与DB的数据/接口.但是,如果您只想做一个脚本将文本数据转换为MySQL表,那么您可能会更轻松地相处.例如,查看从 MySQL官方网站链接的教程.

Just thought to add. The reason to use ORM's is that they provide a very handy way to manipulate data / interface to the DB. But if all you will ever want to do is to do a script to convert textual data to MySQL tables, than you might get along with something even easier. Check the tutorial linked from the official MySQL website, for example.

HTH!