Skip to content

Configuration file

Jarkko Kuukkanen edited this page Apr 29, 2024 · 9 revisions

How to create a configuration file

SQLittaaja uses TOML (Tom's Obvious Minimal Language) as its configuration file format.

The configuration file has to provide initialization data, the correct answer to the exercise, and the location path where student submissions to the exercise can be found.

Configuration structure

Important

Config file has to contain mandatory [sections] and parameters to run SQLittaaja.

The [answer] section may have an initialize parameter, and its value is the SQL script to initialize the database for the exercise. All intended SQL create and insert statements are provided here, enclosed in triple quotes, like a Python multi-line docstring. Another option is to provide initialize_path which points to a SQL script file that will be read and used just like the initialize option.

You can use comments inside the triple quotes, following SQL comment notation: --for single line, /*for multi-line*/

The [[exercises]] section must include a path parameter, specifying the directory path to the zip file containing student submissions as text files. Each entry must also contain answer or answer_path which will be used to check the student answer against. When using answer_path the answer will be read from that file, otherwise the inlined script will be used from the answer option. You may also specify which keywords must and must not be in the students answers using must_contain and must_not_contain respectively.

The [check_options] section includes an optional threshold_pct parameter. This controls the threshold value for similarity checks; if the similarity is below the threshold, it is not reported. Its value ranges between 0.0 and 1.0, representing a percentage (1.0 being 100%). If not provided, the default value is 0.9.

Tip

Copy the example configuration file below and paste in your exercise data.

Example configuration file

[answer]
# This is the initialization script for the database.
initialize = """
CREATE TABLE ...
INSERT INTO ...
"""
# Or you can also give a path to the initialization script file.
initialize_path = "init.sql"

[[exercises]]
# This is the path to a ZIP-file for the student submissions.
path = "path/to/submissions.zip"
# This is the correct answer for the given exercise
# used to check student submissions against.
answer = """
SELECT * FROM ...
"""

[[exercises]]
# You can specify multiple exercises. Mind the double brackets "[["!
path = "path/to/another/submissions.zip"
# You can also give a path to the answer SQL script file.
answer_path = "answer.sql"
# You can specify which keywords must and must not be found in the answer.
must_contain = ["ORDER BY", "ASC", "SELECT"]
must_not_contain = ["DESC"]

[check_options]
# This is the treshold value for similarity check.
treshold_pct = 0.9

Clone this wiki locally