python - SQLAlchemy如何设置外键却不加约束来使用关系?
PHP中文网
PHP中文网 2017-04-18 10:11:07
0
3
505

就是写关系的时候必须要在属性上加有ForeignKey,但是能不能不加约束,仅仅指定外键就使用SQLAlchemy的relationship

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
Peter_Zhu

Since you don’t need constraints, why do you need foreign keys? ? ? Just set a field to store the corresponding relationship

PHPzhong

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!