CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-sqlmodel

SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness.

Overall
score

85%

Overview
Eval results
Files

task.mdevals/scenario-6/

Task Management Database

Build a simple task management database system that stores projects and their associated tasks.

Requirements

Create a database system that:

  1. Defines two data models:

    • A Project model with fields: id (integer, auto-generated), name (string), and description (optional string)
    • A Task model with fields: id (integer, auto-generated), title (string), completed (boolean, defaults to False), and project_id (integer, references Project)
  2. Initializes a SQLite database connection using an in-memory database (:memory:)

  3. Creates all necessary database tables based on the model definitions

  4. Provides a function setup_database() that returns a database session ready for use

Implementation

@generates

API

def setup_database():
    """
    Initialize the database connection, create all tables, and return a session.

    Returns:
        A database session object ready for operations
    """
    pass

Test Cases

  • The setup_database function successfully creates a database session @test
  • The Project table exists in the database after setup @test
  • The Task table exists in the database after setup @test
  • A Project can be inserted and retrieved from the database @test

Dependencies { .dependencies }

sqlmodel { .dependency }

Provides database modeling and SQL operations support.

Install with Tessl CLI

npx tessl i tessl/pypi-sqlmodel

tile.json