0

I have my test model :

from shop import db
    
    
class Product(db.Model):
  id = db.Column(db.Integer, primary_key=True)
  name = db.Column(db.String(50), unique=True, nullable=False)
  price = db.Column(db.Float, nullable=False)
  description = db.Column(db.Text, nullable=False, unique=True)

I create the db, add product, commit :

db.create_all()
from shop.models import Product
p1 = Product(name='p1', price=120.55, description='<h1>tag</h1>')
db.session.add(p1)
db.session.commit()

but when I query the data I get this:

Product.query.all()
>>> [<Product 1>]

0 Answers0