I am trying to create the connection to a database named etl_project but for some reason I keep getting a module not found error
ModuleNotFoundError Traceback (most recent call last) Input In [61], in <cell line: 1>() ----> 1 engine = create_engine('mssql+pyodbc://server/etl_project')
File :2, in create_engine(url, **kwargs)
File c:\Users\David\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\util\deprecations.py:281, in deprecated_params..decorate..warned(fn, *args, **kwargs) 274 if m in kwargs: 275 _warn_with_version( 276 messages[m], 277 versions[m], 278 version_warnings[m], 279 stacklevel=3, 280 ) --> 281 return fn(*args, **kwargs)
File c:\Users\David\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\engine\create.py:599, in create_engine(url, **kwargs) 597 if k in kwargs: 598 dbapi_args[k] = pop_kwarg(k) --> 599 dbapi = dbapi_meth(**dbapi_args) 601 dialect_args["dbapi"] = dbapi 603 dialect_args.setdefault("compiler_linting", compiler.NO_LINTING)
File c:\Users\David\AppData\Local\Programs\Python\Python310\lib\site-packages\sqlalchemy\connectors\pyodbc.py:60, in PyODBCConnector.import_dbapi(cls) 58 @classmethod 59 def import_dbapi(cls) -> ModuleType: ---> 60 return import("pyodbc")
ModuleNotFoundError: No module named 'pyodbc'
engine = create_engine('mssql+pyodbc://server/etl_project')
I think your virtual environment is missing the pyodbc
module. Try installing it with the following command:
pip install pyodbc