I am using Django with an existing Oracle database (i.e. where the tables were NOT created by Django). Therefore, in my models, I need to specify the table name by specifying the value for db_table in the Meta class. I run into problems because the tables that I want to access belong to a different user than those for which I have credentials. I am allowed to view tables (no problem in SQL Developer).
If the Oracle table name would otherwise be more than 30 bytes, Django discards the last four bytes of the name and replaces them with a repeating 4-byte hash of the remaining table names. This is all good and useful for Django tables. It will also normally not be a problem to access tables in existing databases (as in my case), since Oracle itself limited names to 30 bytes.
The problem is that Django does not have a separate means to notify that a table belongs to another user. So I use a temporary solution for the dot syntax (just setting db_table like, for example, "USERNAME.MY_29_BYTE_TABLE_NAMEXXXXXXXX"), but since this causes the table name to be more than 30 bytes in total , Django does its truncated trick and tries to get the table name, which does not exist.
Is there a way to prevent this behavior or another way to specify the user separately from the table name?
source share