'SQLalchemy internals and design pattern [closed]
What is the design pattern in SQLalchemy and how does it work?
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?
We usually don't explicitly define init for the table, however we can use the initializer. How this is done?
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?
Just to understand the internals, let's assume we replace SQL backend with a dictionary. What would be minimal code to simulate SQLalchemy wrt table definition and create_all?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
