Running custom command to load data from another projects'/apps' database
Expected behavior and actual behavior
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 275, in ensure_connection
self.connect()
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 256, in connect
self.connection = self.get_new_connection(conn_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/mssql/base.py", line 368, in get_new_connection
conn = Database.connect(connstr, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/ngallen/development/python/fuel_delivery/manage.py", line 24, in
main()
File "/Users/ngallen/development/python/fuel_delivery/manage.py", line 20, in main
execute_from_command_line(sys.argv)
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, cmd_options)
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, *options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 81, in inner
return func(args, kwds)
^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/development/python/fuel_delivery/sage/management/commands/loadfromsage.py", line 107, in handle
_load_from_sage()
File "/Users/ngallen/development/python/fuel_delivery/sage/management/commands/loadfromsage.py", line 10, in _load_from_sage
with connections["sage_db"].cursor() as cursor:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 316, in cursor
return self._cursor()
^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/mssql/base.py", line 261, in _cursor
conn = super()._cursor()
^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 292, in _cursor
self.ensure_connection()
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 274, in ensure_connection
with self.wrap_database_errors:
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 275, in ensure_connection
self.connect()
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
return func(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 256, in connect
self.connection = self.get_new_connection(conn_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/mssql/base.py", line 368, in get_new_connection
conn = Database.connect(connstr, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
(fuel_delivery-cfjmI6lw) ngallen@Ramadhans-MBP fuel_delivery %
Error message/stack trace**
There are some features which are not supported yet. Please check the Limitations first to see if your bug is listed.
Software versions
Table schema and Model
Database Connection Settings
// Paste your database settings from Settings.py here. "s_db": { "ENGINE": "mssql", "NAME": config("S_DB_NAME"), "USER": config("S_DB_USER"), "PASSWORD": config("S_DB_PASSWORD"), "HOST": config("S_DB_HOST"), "PORT": "", "OPTIONS": { "driver": "ODBC Driver 17 for SQL Server", }, },
Problem description and steps to reproduce
Running custom command to load data from another projects'/apps' database
Expected behavior and actual behavior
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 275, in ensure_connection self.connect() File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner return func(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 256, in connect self.connection = self.get_new_connection(conn_params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/mssql/base.py", line 368, in get_new_connection conn = Database.connect(connstr, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/Users/ngallen/development/python/fuel_delivery/manage.py", line 24, in
main()
File "/Users/ngallen/development/python/fuel_delivery/manage.py", line 20, in main
execute_from_command_line(sys.argv)
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/core/management/base.py", line 413, in run_from_argv
self.execute(*args, cmd_options)
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/core/management/base.py", line 459, in execute
output = self.handle(*args, *options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 81, in inner
return func(args, kwds)
^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/development/python/fuel_delivery/sage/management/commands/loadfromsage.py", line 107, in handle
_load_from_sage()
File "/Users/ngallen/development/python/fuel_delivery/sage/management/commands/loadfromsage.py", line 10, in _load_from_sage
with connections["sage_db"].cursor() as cursor:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 316, in cursor
return self._cursor()
^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/mssql/base.py", line 261, in _cursor
conn = super()._cursor()
^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 292, in _cursor
self.ensure_connection()
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
return func(*args, *kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 274, in ensure_connection
with self.wrap_database_errors:
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/utils.py", line 91, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 275, in ensure_connection
self.connect()
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/utils/asyncio.py", line 26, in inner
return func(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/django/db/backends/base/base.py", line 256, in connect
self.connection = self.get_new_connection(conn_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ngallen/.local/share/virtualenvs/fuel_delivery-cfjmI6lw/lib/python3.12/site-packages/mssql/base.py", line 368, in get_new_connection
conn = Database.connect(connstr, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
django.db.utils.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
(fuel_delivery-cfjmI6lw) ngallen@Ramadhans-MBP fuel_delivery %
Error message/stack trace**
Any other details that can be helpful