flask related interview questions

2. Review 
- wtforms
- SQLALchemy

Questions:
a. What does wtforms do?
      --Form validation, rendering labels
b. What knowledge points are involved in wtforms? Where is it used?
- metaclass
        is used to specify which class to use to create the current class --wtforms sort fields
        metaclass--->class--->instance 
-encapsulation:
        wtforms--UnboundField
        restframework--request
- __new__
        wtforms--instantiation process-field instantiation returns: not StringField, but UnboundField
        restframework--many=true 
        singleton mode--class
method- __mro__
        class inheritance order-
setattr
        cbv, django configuration file, wtforms instantiation: setattr(self, name, field)
         - type(...) 
        type creates class
c. ORM and native SQL comparison?
ORM is simple to operate, and the development efficiency is fast.
      The native SQL operation is complex, and the database execution efficiency is fast
. d. What ORM frameworks have you used?  
      djangoORM
      SQLAlchemy



e. SQLAlchemy 
- database connection pool
- native SQL
- ORM
- table operation
- default value
- index (joint index, if you want to hit the "leftmost prefix" rule)
- set table in sqlalchemy:
- engine
- encoding
- record operation
- CRUD

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325596839&siteId=291194637