SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.
Overall
score
85%
Build a simple task management database system that stores projects and their associated tasks.
Create a database system that:
Defines two data models:
Project model with fields: id (integer, auto-generated), name (string), and description (optional string)Task model with fields: id (integer, auto-generated), title (string), completed (boolean, defaults to False), and project_id (integer, references Project)Initializes a SQLite database connection using an in-memory database (:memory:)
Creates all necessary database tables based on the model definitions
Provides a function setup_database() that returns a database session ready for use
@generates
def setup_database():
"""
Initialize the database connection, create all tables, and return a session.
Returns:
A database session object ready for operations
"""
passProvides database modeling and SQL operations support.
Install with Tessl CLI
npx tessl i tessl/pypi-sqlmodeldocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10