Only import psycopg2 where it is used
Otherwise this module fails to import in environments where a different DB connector from psycopg2 is used. My current employer won't allow the use of pscyopg2 for licensing reasons (don't blame me, look to the legal department). So something like pg8000 needs to be used.
Importing this within the relevant function is a gross solution, but it seemed less gross to me than a try/except statement at the top of the file. However, I'm happy with any solution that doesn't require me to use the psycopg2 as my DB connector in order to use this extension module.
That's a fair compromise. We can totally do that or if we want to detect it, we can have a driver abstraction. Appreciate the PR.