tickets: 6148
This data as json
id | created | changetime | last_pulled_from_trac | stage | status | component | type | severity | version | resolution | summary | description | owner | reporter | keywords | easy | has_patch | needs_better_patch | needs_tests | needs_docs | ui_ux |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6148 | 2007-12-07 00:27:32 | 2021-10-07 08:40:35 | 2022-03-06 03:36:21.749085 | Accepted | new | Database layer (models, ORM) | New feature | Normal | dev | Add generic support for database schemas | There is frequently a need for Django to access data from tables in other schemas; this is especially true when building Django apps on top of legacy databases. Currently, the proposed solution is to add support for the {{{set search_path}}} command (#1051) via custom initialization sql (#6064). This is a good solution for PostgreSQL users, but it will not solve the problem in Oracle, which has no analogue of {{{set search_path}}}. Solving the problem in a generic way will require adding a per-app or per-model db_schema option, in order to issue SQL queries using the syntax {{{"schema_name"."table_name"}}}. This may also require more advanced introspection (at least in Oracle) to determine whether the table already exists when running management commands. A current workaround in Oracle is to manually create private synonyms inside the Django schema, referencing the necessary tables from other schemas. However, the management commands do not currently recognize the existence of synonyms via introspection. Additionally, the synonym solution may not be sufficiently generic in the long term. | ikelly | oracle postgresql mysql schemas | 0 | 1 | 1 | 0 | 0 | 0 |