ORM Both Object Relational Mapping, By using ORM You can use it directly Python Code operation database , Instead of writing tedious SQL. ORM By mapping tables to Model Model ( class ), The fields in the table and Model The attributes in the model correspond to each other ,ORM When the object operation is executed, the corresponding operation will be converted into the native statement of the database SQL Implementation .
Simply speaking ,ORM
Of course ,Python There are more third parties in the ORM frame , such as SqlAlchemy、peebee、Storm etc. ,SQLAlchemy yes Flask The most widely used ORM frame , and Django It's built in ORM frame
differ Flask The framework needs the help of flaks-sqlalchemy Extend to achieve ORM,Django Frame itself ORM, There is no need to install related ORM Expand , But you need to install the relevant database drivers .
Django Virtual object databases in can also be called models , Read and write the target database through the model , The operation steps are as follows :