由Python对数据库操作的一点展开: ORM
在上篇关于自写synthetics工具的文章里,我写入数据库采用的是psycopg2,直接写入。今天想讲一下另一种方法,ORM(Object-relational mapping)和Python里的ORM工具:SQLAlchemy。
SQLAlchemy的三个好处:
- 简化db workflow
- 提供ORM
- 和其他Python库的集成
http://www.ruanyifeng.com/blog/2019/02/orm-tutorial.html
https://hackersandslackers.com/python-database-management-sqlalchemy
https://hackersandslackers.com/sqlalchemy-data-models
https://hackersandslackers.com/database-queries-sqlalchemy-orm
https://hackersandslackers.com/psycopg2-postgres-python/
https://www.youtube.com/watch?v=PTZiDnuC86g
https://www.youtube.com/watch?v=OT5qJBINiJY