官术网_书友最值得收藏!

  • Learning Flask Framework
  • Matt Copperwaite Charles Leifer
  • 171字
  • 2021-07-30 10:18:34

Chapter 2. Relational Databases with SQLAlchemy

Relational databases are the bedrock upon which almost every modern Web application is built. Learning to think about your application in terms of tables and relationships is one of the keys to a clean, well-designed project. As you will see in this chapter, the data model you choose early on will affect almost every facet of the code that follows. We will be using SQLAlchemy, a powerful object relational mapper that allows us to abstract away the complexities of multiple database engines, to work with the database directly from within Python.

In this chapter, we shall:

  • Present a brief overview of the benefits of using a relational database
  • Introduce SQLAlchemy, the Python SQL Toolkit and Object Relational Mapper
  • Configure our Flask application to use SQLAlchemy
  • Write a model class to represent blog entries
  • Learn how to save and retrieve blog entries from the database
  • Perform queries – sorting, filtering, and aggregation
  • Build a tagging system for blog entries
  • Create schema migrations using Alembic
主站蜘蛛池模板: 保山市| 沾化县| 瑞昌市| 木里| 东乡县| 兰州市| 定兴县| 新巴尔虎左旗| 晋宁县| 聂拉木县| 清水河县| 岱山县| 上饶市| 友谊县| 石台县| 福安市| 蕲春县| 安庆市| 威海市| 霸州市| 福海县| 江门市| 漳州市| 临西县| 北碚区| 庆安县| 贵港市| 白山市| 田阳县| 西乡县| 大城县| 亳州市| 江西省| 维西| 宁阳县| 林州市| 安康市| 深州市| 大石桥市| 石门县| 易门县|