mistercrunch commented on PR #32857:
URL: https://github.com/apache/superset/pull/32857#issuecomment-2759793676

   Oh interesting. Wondering if it would make sense to refactor this logic and 
be based on a class attribute instead of the same override in many derived 
classes.  Maybe something like:
   
   ```python
   class BaseEngine:
       ALLOW_DUPLICATE_ALIAS = True
       {...}
       @classmethod. # <<< switching to a classmethod
       def _mutate_label(cls, label: str) -> str:
           """
           Suffix with the first six characters from the md5 of the label to 
avoid
           collisions with original column names
   
           :param label: Expected expression label
           :return: Conditionally mutated label
           """
           if cls.ALLOW_DUPLICATE_ALIAS:
               return label
           else:
               return f"{label}_{md5_sha_from_str(label)[:6]}"
   ```
   Tagging @betodealmeida as the `db_engine_spec` ninja


-- 
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