def execute(self, query, params=None):
    'Overrides NamedTupleCursor.execute.'
    try:
        return super(LoggingNamedTupleCursor, self).execute(query, params)
    finally:
        if (self.query is not None):
            logging.getLogger('dirbs.sql').log(logging.DEBUG, str(self.query, encoding='utf-8'))
Overrides NamedTupleCursor.execute.
def execute(self, query, params=None):
    
    try:
        return super(LoggingNamedTupleCursor, self).execute(query, params)
    finally:
        if (self.query is not None):
            logging.getLogger('dirbs.sql').log(logging.DEBUG, str(self.query, encoding='utf-8'))