Opened 13 years ago
Closed 13 years ago
#16576 closed New feature (duplicate)
Allow working with tables that belong to other users in Oracle
Reported by: | woodlee | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.3 |
Severity: | Normal | Keywords: | db_table |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When using Django against an Oracle DB that has existing tables, Django does not seem to provide any facility for referencing tables that belong to another user/schema.
It is possible to work around this using dot-syntax notation to specify the user (by setting db_table in the model's Meta class as, e.g. “USERNAME.MY_29_BYTE_TABLE_NAMEXXXXXXXX”), but this can lead to the overall "table name" (as perceived by Django) exceeding the 30 byte maximum set in django.db.backends.oracle.base.DatabaseOperations.max_name_length, triggering Django's name truncation behavior (i.e., replacing bytes 27+ of the name with a 4-byte hash) such that Django winds up querying against an nonexistent table name.
Might it be possible to add a new attribute to the model's Meta class, something like db_schema or db_user? And/or, perhaps, to have Django not do its "truncation trick" when the table name has been manually specified via the db_table attribute?
Isn't this #6148?