title: Dependency rule tried to blank-out primary key column in SQL-Alchemy when trying to delete record
body: <p>I have a many to one relationship between the <code>Userownedshare</code> table and the <code>Share</code> table.</p>
  
  <p>When I delete a <code>Userownedshare</code> entry from the database I get the following error: <code>AssertionError: Dependency rule tried to blank-out primary key column 'share.ticker'</code></p>
  
  <p>This makes sense as the <code>ticker</code> field in Userownedshare is a Foreign Key in the <code>Share</code> table. However I cannot work out how to fix this error. I think that I want to set up a cascading deletion when a <code>Share</code> entry is orphaned but I cannot work out how to do this, I have read the documentation but I just end up with different types of errors so I think I am missing something trivial.
  Hope someone can help, thanks!</p>
  
  <p><br>
  Here is my code:</p>
  
  <pre><code>class Userownedshare(db.Model):
      id = db.Column(db.Integer, primary_key=True)
      ticker = db.Column(db.String(20), db.ForeignKey('share.ticker'))
      user = db.Column(db.String, db.ForeignKey('user.username'))
      quantity = db.Column(db.Integer, nullable=False)
      dividends = db.Column(db.Float, server_default="0.0")
      triggerlevel = db.Column(db.Integer)
      smsalert = db.Column(db.Boolean)
      emailalert = db.Column(db.Boolean)
      portfolioid = db.Column(db.String(50))
      name = db.relationship('Share', backref='userownedshare' ,  foreign_keys=[ticker])
  
  class Share(db.Model):
      id = db.Column(db.Integer)
      name = db.Column(db.String(50), nullable=False)
      ticker = db.Column(db.String(50), db.ForeignKey('userownedshare.ticker'), primary_key=True)
      tickermatch = db.relationship('Userownedshare', backref='share',  foreign_keys=[ticker])
  </code></pre>