I would like to use Django 2.0 with legacy MS SQL Server database.
Latest information regarding usage Django with MS SQL Server i could find is Using Sql Server with Django in production/These days and it is about Django 1.11 Most supported seems django-pyodbc-azure but it's not supporting Django 2.0 yet: django-pyodbc-azure issue #124
Is there any alternative?
Django has a built-in web server that is used for development purposes. The framework supports several database management systems including Microsoft SQL Server.
Django officially supports the following databases: PostgreSQL. MariaDB. MySQL.
django-pyodbc is a Django SQL Server DB backend powered by the pyodbc library. pyodbc is a mature, viable way to access SQL Server from Python in multiple platforms and is actively maintained. It's also used by SQLAlchemy for SQL Server connections.
You can connect to a SQL Database using Python on Windows, Linux, or macOS.
Found the solution and post it if anyone facing same problem.
I used django-pyodbc-azure 2.0.4.1 in my Django 2.0.4
The settings that worked for me:
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'dbName',
'USER': 'yourUserName',
'PASSWORD': 'yourPassword',
'HOST': '(local)',
'PORT': '',
'OPTIONS': {
'driver': 'ODBC Driver 11 for SQL Server',
},
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With