title: SQLAlchemy DELETE Error caused by having a both lazy-load AND a dynamic version of the same relationship
body: <p>Here is some example code:</p>
  
  <pre><code>users_groups = Table('users_groups', Model.metadata,
      Column('user_id', Integer, ForeignKey('users.id')),
      Column('group_id', Integer, ForeignKey('groups.id'))
  )
  
  class User(Model):
      __tablename__ = 'users'
      id = Column(Integer, primary_key=True)
  
  
  class Group(Model):
      __tablename__ = 'groups'
      id = Column(Integer, primary_key=True)
  
      users = relationship('User', secondary=users_groups, lazy='select', backref='groups')
      users_dynamic = relationship('User', secondary=users_groups, lazy='dynamic')
  </code></pre>
  
  <p>So what happens here is that if you add a bunch of users to a group like so:</p>
  
  <pre><code>g = Group()
  g.users = [User(), User(), User()]
  session.add(g)
  session.commit()
  </code></pre>
  
  <p>and then try to delete the group</p>
  
  <pre><code>session.delete(g)
  session.commit()
  </code></pre>
  
  <p>You will get some form of this error:</p>
  
  <pre><code>DELETE statement on table 'users_groups' expected to delete 3 row(s); Only 0 were matched.
  </code></pre>
  
  <p>Removing the 2nd version of the relationship (the dynamic one in my case) fixes this problem. I am not even sure where to begin in terms of understanding why this is happening. I have been using 2 versions of various relationships in many cases throughout my SQLAlchemy models in order to make it easy to use the most appropriate query-strategy given a situation. This is the first time it has caused an unexpected issue.</p>
  
  <p>Any advice is welcome.</p>