Schema in django models besides dbo in SQL Server

978 views Asked by At

As I used the SQL Server, Django automatically creates and uses schema dbo for any tables.

Is there any way to use existing schema, or force Django to use create another schema instead of all under dbo schema.

For example:

from django.db import models
import pyodbc
# Create your models here.

class Meetup(models.Model):
    title = models.CharField(max_length=255)
    slug = models.SlugField(unique=True)
    description = models.TextField()

Django has automatically created the table in my SQL Server database

This is my settings.py:

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': "Django",
        'USER': '',
        'PASSWORD': '',
        'HOST': "DESKTOP-VA0DOPJ",
        'PORT': '',
        'OPTIONS': {
            'driver': 'ODBC Driver 17 for SQL Server',
            'isolation_level': 'READ UNCOMMITTED',  # prevent SELECT deadlocks
        },
    },
}
0

There are 0 answers