#6148: Add generic support for database schemas -------------------------------------+------------------------------------- Reporter: ikelly | Owner: akaariai Type: New feature | Status: new Component: Database layer | Version: SVN (models, ORM) | Resolution: Severity: Normal | Triage Stage: Design Keywords: oracle postgresql | decision needed mysql schemas | Needs documentation: 1 Has patch: 1 | Patch needs improvement: 1 Needs tests: 1 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by akaariai): The added patch (6148_django1.5.diff) should make it easier to test this feature. Short usage instructions: - set model specific schema by using Meta.db_schema option (works similarly to db_table, also present for `ManyToManyFields`) - set database specific schema by settings.py DATABASES setting 'SCHEMA'. - when running raw SQL you will need to use connection.qname to get the schema qualified table name of a model (the tests contain plenty of examples, search for qname in regressiontests/queries/tests.py). - note that on MySQL and Oracle the schemas must be prefixed by the database alias to avoid collisions between production and testing. This is the reason for the above qname usage - you do not know the table's qualified name, and it will be different in testing and production. - do not test the patch on a database instance containing production data. It is possible that running tests will drop your production schemas instead of testing schemas. This should not happen, but the feature is currently alpha quality... Otherwise basic usage should work including syncdb. There might be oddities in table creation SQL output from manage.py sql* commands, and inspectdb isn't too well schema aware currently. -- Ticket URL: <https://code.djangoproject.com/ticket/6148#comment:112> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.