 <p>To change from a many-to-many relationship to a one-to-one, start by removing the <code>best_friends</code> table. </p> <pre><code>friends = db.Table('friends', db.Column('user_id', db.Integer, db.ForeignKey('user.id')), db.Column('friend_id', db.Integer, db.ForeignKey('user.id')) ) </code></pre> <p>You then want to add a foreign key to <code>User</code> that references another <code>User</code>. </p> <pre><code>class User(db.Model): id = db.Column(db.Integer, primary_key = True) name = db.Column(db.String(50), index=True, unique= True) email = db.Column(db.String(50),index=True, unique= True) bestfriend_id = db.Column(db.Integer, db.ForeignKey('user.id')) bestfriend = db.relationship('User', remote_side=['id'], lazy='dynamic') def are_bestfriends(self, user): return self.best_friend == user def be_bestfriend(self, user): if not self.are_bestfriends(user): self.bestfriend = user user.bestfriend = self return self </code></pre>