sqlite3_model¶
-
class
egegrouper.sqlite3_model.
Model
[source]¶ Model implementation for SQLite3 SME database.
-
create_storage
(self, file_name)[source]¶ Create new database.
Parameters: file_name (str) – File name.
-
delete_exam
(self, exam_id)¶ Remove examination from database.
Parameters: exam_id (str) – Examination ID.
-
delete_group
(self, group_id)¶ Delete group of examinations from database.
Parameters: group_id (str) – Group ID.
-
static
do_if_storage_opened
(method)¶ Decorator. If storage is not opened AttributeError raised.
-
exam
(self, exam_id)¶ Return examination from database.
Parameters: - exam_id (str) – Examination ID.
- meta_only (bool) – Get only meta data if True.
Returns: Examination object.
Return type:
-
exams
(self, group_id, meta_only)¶ Return exams from selected group or groups.
Parameters: - group_id (str or list of str) – Group ID. If list, the union of sets of examinations from groups returned.
- meta_only (bool) – If True, only meta data returned.
Returns: exams – Examinations list.
Return type: list of sme.Examination
-
group_exam
(self, exam_id, group_ids, placed_in)¶ Add and delete examination to and from groups.
Parameters: - exam_id (str) – Examination ID.
- group_ids (list of str) – Group IDs.
- placed_in (list of bool) – True for examinations to be placed in groups. Length of group_ids must be equal to length of placed_in.
-
group_info
(self, group_id)¶ Return short information about examinations in selected group.
Parameters: group_id (str) – Group ID Returns: - data (list of tuple) – Examination descriptions.
- headers (tuple) – Headers.
-
group_record
(self, group_id)¶ Return attribute names and values of selected group.
Parameters: group_id (str) – Group ID. Returns: Attributes names and values for selected group. Return type: OrderedDict
-
insert_exam
(self, e)¶ Insert examination into current database.
Parameters: exam (sme.Examination) – Examination object
-
insert_group
(self, name, description)¶ Add new group of examinations.
Parameters: - name (str) – Name of new group.
- description (str) – Description for new group.
-
storage_exists
(self, file_name)[source]¶ Check if the file exists.
Parameters: file_name (str) – Name of database file. Returns: True if exists, False otherwise. Return type: bool
-
storage_info
(self)¶ Return tabular information about database.
Returns: - ext_data (list of tuple) – Table with information about database.
- ext_headers (tuple) – Headers.
-
update_group_record
(self, group_id, attr)¶ Update group record in database.
Parameters: - group_id (str) – Group ID.
- attr (OrderedDict) – Attributes names and values.
-
where_exam
(self, exam_id)¶ Return description of groups where examination in or not in.
Parameters: exam_id (str) – Examination ID. Returns: - group_records (list of tuple) – All group records.
- headers (list of str) – Names of group attributes.
- placed_in (list of bool) – True if exam in group, False otherwise.
-