Skip to main content

RWTH Aachen Computer Science i5/dbis assets for Lecture Datenbanken und Informationssysteme

Project description

DBIS SQL Exercise Generator

pypi PyPI Status

Installation

Install via pip:

# Not yet available on PyPI
pip install dbis-sql-exercise-generator

Most notably, following required packages are also installed:

Usage

from rc_exercise_generator import generate_exercise

# set the solution as SQLite query (string)
solution_sql_query = "SELECT a, c FROM R;"

from excmanager.Task import Exercise, Task, SubTask
exercise1 = Exercise(1)
task1 = Task(exercise1, "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_sql_query,
	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 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 and this test for more information on what cells are generated and how one can incorporate them into an exercise Jupyter notebook.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbis-sql-exercise-generator-0.0.1.tar.gz (7.1 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page