Based on this Gist , I changed django.core.management.commands.inspectdb: around line 32, in handle_inspection(), after cursor = connection.cursor(), add cursor.execute("SET search_path TO myotherschema").
def handle_inspection(self, options):
connection = connections[options.get('database')]
table2model = lambda table_name: table_name.title().replace('_', '').replace(' ', '').replace('-', '')
cursor = connection.cursor()
cursor.execute("SET search_path TO myotherschema")
At a minimum, Django 1.9:
def handle_inspection(self, options):
with connection.cursor() as cursor:
cursor.execute("SET search_path TO myotherschema")
source
share