Skip to content


This is an example delete clause:



This is the database change for the foreign key. You add it to each model.

Ticker Class:

asset_class_id = db.Column(db.Integer, db.ForeignKey('asset_class.asset_class_id'), nullable=False)

Asset Class

tickers = db.relationship('Ticker', backref='tickers', lazy=True)

Database Create

In your database table for ticker, you will make a foreign key relationship.

The foreign key name can be whatever. You select the asset_class table as the referenced table. Then you select reference the asset_class_id in both tables. Make sure you select On Update Cascade, and On Delete Cascade.