Skip to content

Redesigned architecture, added the ability to add your own output handlers

Latest
Compare
Choose a tag to compare
@Friskes Friskes released this 01 Dec 13:10

Customization of the display

To customize the display of SQL queries, you can import a list with handlers and remove handlers from it or expand it with your own handlers.

from capture_db_queries import settings, IHandler

# NOTE: The handler must comply with the specified interface.
class SomeHandler(IHandler):
    def handle(self, queries_log):
        for query in queries_log:
            query.sql = "Hello World!"
        return queries_log

settings.PRINTER_HANDLERS.remove("capture_db_queries.handlers.ColorizeSqlHandler")
settings.PRINTER_HANDLERS.append("path.to.your.handler.SomeHandler")