Metadata-Version: 2.1
Name: dbis-relational-algebra-exercise-generator
Version: 0.0.3
Summary: RWTH Aachen Computer Science i5/dbis assets for Lecture Datenbanken und Informationssysteme
Author-email: Til Mohr <til.mohr@rwth-aachen.de>
Project-URL: Homepage, https://git.rwth-aachen.de/i5/teaching/dbis/dbis-relational-algebra-exercise-generator
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENCE

# DBIS Relational Algebra Exercise Generator

[![pypi](https://img.shields.io/pypi/pyversions/dbis-relational-algebra-exercise-generator)](https://pypi.org/project/dbis-relational-algebra-exercise-generator/)
[![PyPI Status](https://img.shields.io/pypi/v/dbis-relational-algebra-exercise-generator)](https://pypi.org/project/dbis-relational-algebra-exercise-generator/)

This library generates relational algebra exercises based on the [dbis-relational-algebra](https://pypi.org/project/dbis-relational-algebra) library.
# Installation
Install via pip:
```bash
pip install dbis-relational-algebra-exercise-generator
```
Most notably, following required packages are also installed:
 - [dbis-relational-algebra](https://pypi.org/project/dbis-relational-algebra)
 - [dbis-exc-manager](https://pypi.org/project/dbis-exc-manager/)

# Usage
```python
from ra_exercise_generator import generate_exercise

from relational_algebra import *
solution_algebra_expression = Projection("R", ("R.a", "R.c"))

from excmanager.Task import Exercise, Task, SubTask
exercise1 = Exercise(1)
task1 = Task(excercise1, "1.1")
subtask1 = SubTask(task1, "a", points=2)
# task description
description = "Select the attributes a and c from the relation R."

generated_cells = generate_exercise(
	subtask1,
	description,
	solution_algebra_expression,
	correct_attributes_score_perc=0.1
)

# generated_cells is a dictionary of cells, which can be used to generate a Jupyter Notebook
# format:
# filename (str) -> cell content (str)
```


## :warning: Guidelines
In order to directly use the generated cells in an exercise Jupyter notebook, one should follow the following guidelines:
 - [tasks](https://pypi.org/project/dbis-exc-manager/) should be named `task1`, `task2`, ...
 - The SQLite Connection has to be made beforehand. This connection should be stored in the variable `sql_con`.

View the [templates](ra_exercise_generator/resources/templates/README.md) and [this test](tests/test_correct.py) for more information on what cells are generated and how one can incorporate them into an exercise Jupyter notebook.


