Package: django-mssql-azure-backend
django-mssql-azure-backendis a fork ofdjango-mssql-backendFeaturesSupports Django 2.2, 3.0Supports Microsoft SQL Server 2008/2008R2, 2012, 2014, 2016, 2017, 2019Passes most of the tests of the Django test suiteCompatible withMicosoft ODBC Driver for SQL Server,SQL Server Native Client,
andFreeTDSODBC driversDependenciesDjango 2.2 or newerpyodbc 3.0 or newerInstallationInstall pyodbc and DjangoInstall django-mssql-azure-backendpip install django-mssql-azure-backendNow you can point theENGINEsetting in the settings file used by
your Django application or project to the'sql_server.pyodbc'module path'ENGINE': 'sql_server.pyodbc'Regex Supportdjango-mssql-backend supports regex using a CLR .dll file. To install it, runpython manage.py install_regex_clr {database_name}ConfigurationStandard Django settingsThe following entries in a database-level settings dictionary
in DATABASES control the behavior of the backend:ENGINEString. It must be"sql_server.pyodbc".NAMEString. Database name. Required.HOSTString. SQL Server instance in"server\instance"format.PORTString. Server instance port.
An empty string means the default port.USERString. Database user name in"user"format.
If not given then MS Integrated Security will be used.PASSWORDString. Database user password.IS_AZURE_BASED_TOKENBoolean. Set this to True if you want to connect azure DB without userid and password
if it false or not given, DB will connect using userid and passwordAUTOCOMMITBoolean. Set this to False if you want to disable
Django’s transaction management and implement your own.and the following entries are also available in the TEST dictionary
for any given database-level settings dictionary:NAMEString. The name of database to use when running the test suite.
If the default value (None) is used, the test database will use
the name “test_” +NAME.COLLATIONString. The collation order to use when creating the test database.
If the default value (None) is used, the test database is assigned
the default collation of the instance of SQL Server.DEPENDENCIESString. The creation-order dependencies of the database.
See the official Django documentation for more details.MIRRORString. The alias of the database that this database should
mirror during testing. Default value isNone.
See the official Django documentation for more details.OPTIONSDictionary. Current available keys are:driverString. ODBC Driver to use ("ODBC Driver 13 for SQL Server","SQL Server Native Client 11.0","FreeTDS"etc).
Default is"ODBC Driver 13 for SQL Server".isolation_levelString. Setstransaction isolation levelfor each database session. Valid values for this entry areREAD UNCOMMITTED,READ COMMITTED,REPEATABLE READ,SNAPSHOT, andSERIALIZABLE. Default isNonewhich means
no isolation levei is set to a database session and SQL Server default
will be used.dsnString. A named DSN can be used instead ofHOST.host_is_serverBoolean. Only relevant if using the FreeTDS ODBC driver under
Unix/Linux.By default, when using the FreeTDS ODBC driver the value specified in
theHOSTsetting is used in aSERVERNAMEODBC connection
string component instead of being used in aSERVERcomponent;
this means that this value should be the name of adataserverdefinition present in thefreetds.confFreeTDS configuration file
instead of a hostname or an IP address.But if this option is present and it’s value isTrue, this
special behavior is turned off.Seehttp://www.freetds.org/userguide/dsnless.htmfor more information.unicode_resultsBoolean. If it is set toTrue, pyodbc’sunicode_resultsfeature
is activated and strings returned from pyodbc are always Unicode.
Default value isFalse.extra_paramsString. Additional parameters for the ODBC connection. The format is"param=value;param=value".collationString. Name of the collation to use when performing text field
lookups against the database. Default isNone; this means no
collation specifier is added to your lookup SQL (the default
collation of your database will be used). For Chinese language you
can set it to"Chinese_PRC_CI_AS".connection_timeoutInteger. Sets the timeout in seconds for the database connection process.
Default value is0which disables the timeout.connection_retriesInteger. Sets the times to retry the database connection process.
Default value is5.connection_retry_backoff_timeInteger. Sets the back off time in seconds for reries of
the database connection process. Default value is5.query_timeoutInteger. Sets the timeout in seconds for the database query.
Default value is0which disables the timeout.backend-specific settingsThe following project-level settings also control the behavior of the backend:DATABASE_CONNECTION_POOLINGBoolean. If it is set toFalse, pyodbc’s connection pooling feature
won’t be activated.ExampleHere is an example of the database settings forazure token:DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'mydb',
        'HOST': 'myserver.database.windows.net',
        'PORT': '',
        'IS_AZURE_BASED_TOKEN': True
        'OPTIONS': {
            'driver': 'ODBC Driver 13 for SQL Server',
        },
    },
}If you are using alocal SQL server, use the below configuration.DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'mydb',
        'USER': 'user@myserver',
        'PASSWORD': 'password',
        'HOST': 'myserver.database.windows.net',
        'PORT': '',
        'IS_AZURE_BASED_TOKEN': False

        'OPTIONS': {
            'driver': 'ODBC Driver 13 for SQL Server',
        },
    },
}

# set this to False if you want to turn off pyodbc's connection pooling
DATABASE_CONNECTION_POOLING = FalseLimitationsThe following features are currently not supported:Altering a model field from or to AutoField at migration