sqlalchemy-citext icon indicating copy to clipboard operation
sqlalchemy-citext copied to clipboard

Only import psycopg2 where it is used

Open eestrada opened this issue 4 years ago • 1 comments

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.

eestrada avatar Mar 22 '21 22:03 eestrada

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.

mahmoudimus avatar Mar 23 '21 04:03 mahmoudimus