tessl install tessl/pypi-sqlmodel@0.0.0SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.
Agent Success
Agent success rate when using this tile
85%
Improvement
Agent success rate improvement when using this tile compared to baseline
1x
Baseline
Agent success rate without this tile
85%
Build a product catalog database model with proper field constraints and validation.
Create a database model for an e-commerce product catalog that properly defines fields with appropriate constraints, validation rules, and database-level configurations.
Create a Product table model with the following specifications:
Create a Category table model with:
Establish a proper relationship between Category and Product models where a category can have multiple products.
Implement functions to:
@generates
from sqlmodel import SQLModel, Field, Relationship, create_engine, Session
from typing import Optional, List
from decimal import Decimal
from datetime import datetime
class Category(SQLModel, table=True):
"""Category model for organizing products."""
pass
class Product(SQLModel, table=True):
"""Product model with field constraints and validation."""
pass
def create_database() -> tuple:
"""
Create database engine and tables.
Returns:
tuple: (engine, session) for database operations
"""
passProvides database modeling with validation support.