Skip to main content

Django backend for Microsoft SQL Server with AAD and Azure MSI suport

Project description

django-mssql-backend-aad is a fork of django-mssql-backend to add support for AAD (backported changes from django-azure-sql-backend), and Azure MSI

This package is not being actively maintain. Use only as reference

Dependencies

  • Django 2.2 or newer

  • pyodbc 3.0 or newer

  • msal 1.5.1 or newer

Installation

  1. Install pyodbc and Django

  2. Install django-mssql-backend

    pip install django-mssql-backend-aad
  3. Now you can point the ENGINE setting in the settings file used by your Django application or project to the 'sql_server.pyodbc' module path

    'ENGINE': 'sql_server.pyodbc'

Configuration

AAD Example

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'mydb',
        'HOST': 'myserver.database.windows.net',
        'PORT': '',
        'AAD-AUTH': {
            'tenant_id': '02a2e49f-b581-45c4-84a9-bdee0198b26f',
            'client_id': '818979f8-a731-48d9-bf42-b00a04e1e618',
            'secret': "MY_SUPER_SECRET",
        },
        '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 = False

MSI Example

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'mydb',
        'HOST': 'myserver.database.windows.net',
        'PORT': '',
        'MSI-AUTH': 'True',
        '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 = False

For additional usage and installation instructions, please refer to: - https://pypi.org/project/django-mssql-backend - https://github.com/langholz/django-azure-sql-backend

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-mssql-backend-aad-0.2.1.tar.gz (42.5 kB view hashes)

Uploaded Source

Built Distribution

django_mssql_backend_aad-0.2.1-py3-none-any.whl (53.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page