I have a model which defines (amongst other things):

class Push(db.Model):
    __tablename__ = 'push'
    repository = db.Column(db.String)
    branch = db.Column(db.String, primary_key=True)
    before = db.Column(db.String, primary_key=True)
    after = db.Column(db.String, primary_key=True)
    merge_request_id = db.Column(db.Integer,
                                 db.ForeignKey('merge_request.iid'))

class MergeRequest(db.Model):
    __tablename__ = 'merge_request'
    iid = db.Column(db.Integer, primary_key=True)
    repository = db.Column(db.String)
    branch = db.Column(db.String)
    pushes = db.relationship(Push, backref="merge_request")

In my application I can create a MergeRequest and a Push in a transaction 
and relate them through merge_request_id but before the objects are 
committed, when I try to access "push.merge_request" the attribute is None 
but if I manually load the object I get it through "merge_request = 
MergeRequest.query.get(push.merge_request_id)".


     Richard

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to