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