I’m trying to script a process wherein I scrape data from a website and store it in a MySQL DB table. I was facing some configuration issues so I copied the MySQL connectivity segment into a separate Jupyter Notebook and tested the connection. After debugging, it worked out perfectly in this notebook. I then proceeded to integrate this solution into the original Jupyter Notebook, but whenever I run the script, it throws an error.
Main notebook:
lot of scraping code
engine = sqlalchemy.create_engine("mysql+pyodbc://user:password@localhost/DATABASE?"
,echo=False)
previous_data = pd.read_sql_table('data', engine.connect())
This is throwing an error in the main notebook.
The error
DBAPIError: (pyodbc.Error) ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/usr/lib/x86_64-linux-gnu/odbc/libmyodbc8w.so' : file not found (0) (SQLDriverConnect)")
But the same code, in the other notebook is working fine(?!)
Test notebook
engine = sqlalchemy.create_engine("mysql+pyodbc://user:password@localhost/DATABASE?"
,echo=False)
previous_data = pd.read_sql_table('data', engine.connect())
Even though this driver does exist (hence why the connection is able to establish at all in the test notebook).
I have tried
- restarting the kernel in both notebooks, in order to avoid any sort of interference
- using close() method, to terminate the connection in one notebook, before instantiating in the other notebook
- checking all the libraries that I’m using in order to make sure I am using the relevant libraries.
- keeping the driver location open (and staring at the driver) while running the script to make sure that the driver still exists while I’m running the script and is not deleted due to some random thing.
kalium is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.