mercredi 19 janvier 2022

SQLalchemy internals and design pattern

What is the design pattern in SQLalchemy and how does it work?

  1. I wonder how defining each column as class variable in a child class of db.Model provides necessary information to create table. How does db.create_all get these data?

  2. We usually don't explicitly define init for the table, however we can use the initializer. How this is done?

  3. Why this design has been used? Is it because class variables are initiated when the interpreter reaches the definition, while there can be many instances?

Aucun commentaire:

Enregistrer un commentaire