Application.database ==================== .. py:module:: Application.database Attributes ---------- .. autoapisummary:: Application.database.logger Exceptions ---------- .. autoapisummary:: Application.database.GarbageMessListError Classes ------- .. autoapisummary:: Application.database.ConnectionPool Functions --------- .. autoapisummary:: Application.database.connect Application.database.scan_mess_list Application.database.read_mess_list Application.database.get_file_name Application.database.get_all_info Application.database.get_hoscode_roomno_from_short_id Application.database.set_nick Application.database.get_nick Application.database.get_name Application.database.get_all_nicks Application.database.resolve_id Module Contents --------------- .. py:data:: logger .. py:exception:: GarbageMessListError Bases: :py:obj:`Exception` Common base class for all non-exit exceptions. .. py:function:: connect() -> sqlite3.Connection .. py:class:: ConnectionPool Allows database connections to be reused Attributes: _q: A queue.SimpleQueue that stores the connections .. py:attribute:: _q .. py:method:: __enter__() -> sqlite3.Connection Gets a connections from ConnectionPool._q, creates a new connection if the queue is empty. Returns: sqlite3.Connection .. py:method:: __exit__(exc_type, exc_val, exc_tb) Commits the changes if there was no error, rolls back if there was an error. Puts the connection back into the queue. Args: exc_type (): exc_val (): exc_tb (): .. py:method:: close() :classmethod: Closes all open database connections .. py:function:: scan_mess_list(path: pathlib.Path) -> list[dict[str, str]] Verifies that the csv file is a messand returns which datatype of each column .. py:function:: read_mess_list(path: pathlib.Path) Populates the database with values from a csv file. Args: path: Path to the csv file .. py:function:: get_file_name(id) Returns the file name skeleton which can be formated with the roll number. This if the name of the output of the billing process. Args: id (): The complete ID of the person who's image is being saved. Returns: str of the form "hoscode_roomno_{}_YEARLAST4DIGITS" .. py:function:: get_all_info(id) Returns the file name skeleton which can be formated with the roll number. This if the name of the output of the billing process. Args: id (): The complete ID of the person who's image is being saved. Returns: str of the form "hoscode_roomno_{}_YEARLAST4DIGITS" .. py:function:: get_hoscode_roomno_from_short_id(id) Basically only used to rename files in the event of a fuckup .. py:function:: set_nick(nick, id) .. py:function:: get_nick(id) .. py:function:: get_name(id) .. py:function:: get_all_nicks() .. py:function:: resolve_id(id_last_four, bhawan, roomno)