FrancescoCastaldi commented on issue #45758:
URL: https://github.com/apache/superset/issues/45758#issuecomment-6524026666

   ### Root Cause Analysis & Solution
   
   In `superset/db_engine_specs/oracle.py`, 
`OracleEngineSpec.max_column_name_length` is statically declared as 128.
   
   While 128-byte identifiers were introduced in Oracle 12.2, earlier releases 
(including Oracle 11g and 12.1) strictly enforce a 30-byte identifier limit. 
Queries containing alias labels longer than 30 characters fail with `ORA-00972: 
identifier is too long`.
   
   #### Solution
   1. Add dynamic method `get_max_column_name_length(cls, database: Database | 
None = None) -> int | None` to `BaseEngineSpec`.
   2. In `OracleEngineSpec`, inspect the server version: if the version is 
prior to 12.2, return 30; otherwise return 128.
   3. Pass `database` into `make_label_compatible` in `ExploreMixin` to 
dynamically truncate alias labels to 30 characters on legacy Oracle instances.
   
   Verified with unit tests in 
`tests/unit_tests/db_engine_specs/test_oracle.py` and committed to branch 
`fix/community-unanswered-issues` (commit `94860113543`) at 
https://github.com/FrancescoCastaldi/superset/tree/fix/community-unanswered-issues.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to