moj-analytical-services / pydbtools

Python version of dbtools
https://moj-analytical-services.github.io/pydbtools/
10 stars 2 forks source link

Add logging #43

Closed RobinL closed 3 years ago

RobinL commented 3 years ago

Should help us solve #41, and I think is generally useful for any future debugging.

Use in Jupyter Lab like:

import logging 
logging.basicConfig()  
logging.getLogger("pydbtools").setLevel(logging.DEBUG)

You get out a log like (i've replaced some of the strings with REDACTED)

DEBUG:pydbtools.wrangler:Modifying function create_temp_table
DEBUG:pydbtools.wrangler:
{'boto3_session': Session(region_name='eu-west-1'),
 'sql': 'REDACTED',
 'table_name': 'pc_with_REDACTED'}
RobinL commented 3 years ago

I think I misunderstood how pprint works - just a sec while I fix