dbReport’s Documentation

The dbReport package will generate HTML reports from a sqlite database. It uses views defined in the database to collect the data for the reports, and a JSON file to configure how the reports are generated and related to each other. The project can be found on github


This project is not hosted on PyPi, so to install it will require building the project from source.

Since this module has several sub-modules (js plugins), to clone, perform the following steps to clone it with all the sub-modules populated.

>> git clone https://github.com/josephjcontreras/dbreport.git
>> cd dbReport
>> git submodule init
>> git submodule update

For further details about submodules, refer to the git documentation.

Once cloned, install the requirements by running pip install -r requirements.txt or pip install -r requirements-dev.txt, depending on how you will use the project.

Example Setup

Once dbReport has been installed, it can be used to start generating reports.

"paths": {
    "database": ".\\test-database.db",
    "report_dir": ".\\reports"

For simple cases that do not require processing of data queried from the database, the reports can be rendered as shown.

def main():
    report = Report('layout.json')

In other cases where the parse function is required, create a python class that inherits from the dbreport.Report class. This will allow the parse method to be overloaded and changed.

from dbreport import Report

class myCustomReport(Report):
    def __init__(self, layout_path):

    def parse(self, data):
        This custom parse function will be called on the data

        See documentation for more details.

        # for this case, we're just going to print the data to
        # show that it is working

        # be sure to return the data
        return data

def main():
    # use this function to instantiate the class and generate reports
    report = myCustomReport('layout.json')

After running these examples, there will be an html report for each view defined in test-database.db.