flask sqlalcheme migration error:- AttributeError: 'RelationshipProperty' object has no attribute '_set_parent_with _dispatch'

19 views
Skip to first unread message

JAI PRAKASH SINGH

unread,
May 20, 2015, 8:08:13 AM5/20/15
to flask-...@googlegroups.com
Hello all, 

    I am stuck at a point, 

    i have to do this 

    1) to  make a table which will hold the record of  contacts associated with a   
       particular project id ( so that we can get whole contacts of a perticular project or vise versa)
  
    2) so I am using many to many relation as under 

============================================================================
    project_contacts = db.Table('project_contacts',
          db.Column('project_id', db.Integer, db.ForeignKey('projects.id')),
          db.Column('contact_id', db.Integer, db.ForeignKey('contacts.id'))
    )


    class Projects(db.Model):
          -----
          contacts = db.relationship('Contact',
                               secondary=project_contacts,
                               backref='projects',
                               lazy='dynamic')
         -----
==============================================================================




    and in migration file : 
==============================================================
   def upgrade():
          --------
           op.add_column('projects', sa.Column('contacts',
                                       sa.orm.relationship('Contact',
                                                        secondary=project_contacts,
                                                         backref='projects',
                                                         lazy='dynamic')))
         ---------

==========================================================
error:- 

AttributeError: 'RelationshipProperty' object has no attribute '_set_parent_with
_dispatch'


I searched a lot but unable to find how to deal with this, do you have any idea how to do many to many migration ?
Reply all
Reply to author
Forward
0 new messages