database.resources.io ===================== .. py:module:: database.resources.io Attributes ---------- .. autoapisummary:: database.resources.io.EXPORT_DIR database.resources.io.IMPORT_DIR Functions --------- .. autoapisummary:: database.resources.io.database_connection database.resources.io.database_table_write database.resources.io.import_data_file database.resources.io.setup_log_file Module Contents --------------- .. py:function:: database_connection(filepath: str) -> str Creates a connection to an SQLite database. :param filepath: The location where the database will be stored. Must end in .db :type filepath: str :returns: SQLAlchemy engine and connection. .. py:function:: database_table_write(engine, dataframe: polars.DataFrame, table_name: str) Writes the given dataframe to the SQLite Database :param engine: Sqlalchemy SQLite database engine :param dataframe: Polars series dataframe :type dataframe: pl.DataFrame :param table_name: The name of the table to be written :type table_name: str .. py:function:: import_data_file(filepath: pathlib.Path) -> str Checks for the type of file provided and then loads it into a Polars dataframe. :param filepath: The file path of data to import (CSV or XLSX) :type filepath: str .. py:function:: setup_log_file() -> str Creates the log file for the script. :returns: Creates a log file in the parent directory. Removes old ones. .. py:data:: EXPORT_DIR .. py:data:: IMPORT_DIR