Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python flask many to many relation db

from sqlalchemy.orm import relationship, backref

class Order(BaseModel):
    __tablename__ = 'orders'
    id = db.Column(db.Integer, primary_key=True)
    user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
    product_id = db.Column(db.Integer, db.ForeignKey('products.id'))
Source by michaelcho.me #
 
PREVIOUS NEXT
Tagged: #python #flask #relation #db
ADD COMMENT
Topic
Name
8+3 =