I'm trying to develop a django interface for an existing postgresql db, the db makes use of various schemas, looking at the literature the following example should work, but it only returns the schema defined in the default database when I run python manaage.py inspectdb
. Also when this works, how do I define which schema to use when defining the django model?
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'OPTIONS' : {
'options': '-c search_path=public'
},
'NAME': 'gygaia',
'USER':'postgres',
'PASSWORD':'abc',
'HOST':'localhost',
'PORT':'5432',
},
'samples': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'OPTIONS' : {
'options': '-c search_path=samples'
},
'NAME': 'gygaia',
'USER':'postgres',
'PASSWORD':'abc',
'HOST':'localhost',
'PORT':'5432',
},
'excavation': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'OPTIONS' : {
'options': '-c search_path=excavation'
},
'NAME': 'gygaia',
'USER':'postgres',
'PASSWORD':'abc',
'HOST':'localhost',
'PORT':'5432',
},
}