就是写关系的时候必须要在属性上加有ForeignKey
,但是能不能不加约束,仅仅指定外键就使用SQLAlchemy的relationship
?
天蓬老师2017-04-18 10:13:07
Since you don’t need constraints, why do you need foreign keys? ? ? Just set a field to store the corresponding relationship
PHPz2017-04-18 10:13:07
Adding foreign keys can maintain data integrity, and you can also set up relationships yourself. That kind of control is easy to use
迷茫2017-04-18 10:13:07
In Python, you can use properties directly instead of foreign keys, but you need to do more work yourself