kippnorcal / sqlsorcery

Dead simple wrapper for pandas and sqlalchemy
https://sqlsorcery.readthedocs.io/en/latest/
MIT License
2 stars 1 forks source link

Reasons for pyodbc import failing #29

Open zkagin opened 4 years ago

zkagin commented 4 years ago

https://github.com/dchess/sqlsorcery/blob/00a14ae7bd65d893d8cfa63a08aad04bd35e71c8/sqlsorcery/__init__.py#L17-L20

@dchess When testing a library using sqlsorcery locally, I'm running into an issue where pyodbc is NoneType, which likely means this import is failing. You seem to have run across this yourself. What was causing the import failure on your end? Can we print out the error so we know there is an issue?

dchess commented 4 years ago

@zkagin The pyodbc import is needed for dynamically pulling the right MS SQL driver:

self.driver = pyodbc.drivers()[-1].replace(" ", "+")

I added that catch on the imports to ignore it when it's not being used. It should only throw an error if you are installing sqlsorcery without pyodbc (through the extras install) and then still instantiating the MSSQL() object.

Interested in what scenario you are getting the NoneType error if not that one.