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