A simple SQL Database logging too, with minimal-code based config and text output, this tool provides arbitarty reports from an SQL Database, just update the settings and run.
- Python 3.6
- To get started clone this repo with
git clone git@github.com:rohanthacker/log-reports.git
- Create a virtualenv with
python -m venv <path to your venv>
- Switch into your venv with
source venv/bin/activate
- Install required the python modules
pip install -r requirements.txt
- You should now have a working copy of log-reports, to test run
./main.py
If everything worked you should see output.txt ( default name ) in your current directory.
Configure settings.py
, the following options are available:
- DB_CONN : The database connection string
- FILENAME: The output filename
- Report : Settings related to your report aka the output document.
The report variable in settings.py is a list of dicts that is explained below:
{
'title': String | The text-title to display above the SQL records found if any,
'sql': String | The SQL query for this report
'format': Function | A lambda function, the func is called with `row` as its first arg,
this function will control your output
}
If your SQL queries are long, it is suggested to put them in a seperate file and import the queries into settings.py, at the end of the day settings is just another python file.
- Rohan Thacker - Initial work - Rohan Thacker