Opened 15 months ago

Closed 15 months ago

Last modified 15 months ago

#28774 closed Uncategorized (duplicate)

Use only a specific database schema instead of 'public' one (like in Postgresql)

Reported by: Riccardo Campisano Owned by: nobody
Component: Database layer (models, ORM) Version: 1.8
Severity: Normal Keywords: django, orm, database, postgresql, schema
Cc: riccardo.campisano@…, ogando@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no



In our project ( we should use a PostgreSQL database used by others application, so that we want to configure Django ORM to use just a specific schema.

I cannot find such kind of configurations in the official documentation. A tip for a kind of such configuration is available in

and it appears to work, using a specific config like that

    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'OPTIONS': {
            'options': '-c search_path=qlf_schema'

However, I would be sure that this is the correct (official, supported) way to do such thing, and that will be supported in the future (and that this is not a workaround that currently work but can break in a next version of Django).


Change History (2)

comment:1 Changed 15 months ago by Tim Graham

Resolution: duplicate
Status: newclosed

Official support for database schemas is discussed in #6148.

I think the '-c search_path=qlf_schema' method you mentioned uses a psycopg2 configuration option and I wouldn't expect that to stop working unless psycopg2 changes it.

comment:2 Changed 15 months ago by Riccardo Campisano

Thank you for the tip and the link to the discussion.


Note: See TracTickets for help on using tickets.
Back to Top