Working in a project with SQLAlchemy, I've found 1:0 relations like this:
class MyModel(db.Model):
__tablename__ = 'my_model'
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(255))
...
stipend = db.relationship('models.Stipend', uselist=False)
So, the field stipend is in the Stipend table related with a 1:0 relationship (well, a foreign key). I'm not an expert with RDBMS patterns, so this don't have many sense to me. I'd like to include stipend as a nullable field.
So, the question is: For what use cases 1:0 relationships have sense?
Aucun commentaire:
Enregistrer un commentaire