diff --git a/superset/db_engine_specs/ocient.py b/superset/db_engine_specs/ocient.py index b66216bf5ca98..417919c62acdf 100644 --- a/superset/db_engine_specs/ocient.py +++ b/superset/db_engine_specs/ocient.py @@ -163,6 +163,9 @@ class OcientEngineSpec(BaseEngineSpec): force_column_alias_quotes = True max_column_name_length = 30 + allows_cte_in_subquery = False + # Ocient does not support cte names starting with underscores + cte_alias = "cte__" # Store mapping of superset Query id -> Ocient ID # These are inserted into the cache when executing the query # They are then removed, either upon cancellation or query completion @@ -260,30 +263,30 @@ def fetch_data( cursor ) - if columns_to_sanitize: - # At least 1 column has to be sanitized. - - def identity(x: Any) -> Any: - return x - - # Use the identity function if the column type doesn't need to be - # sanitized. - sanitization_functions: List[SanitizeFunc] = [ - identity for _ in range(len(cursor.description)) - ] - for info in columns_to_sanitize: - sanitization_functions[info.column_index] = info.sanitize_func - - # pyocient returns a list of NamedTuple objects which represent a - # single row. We have to do this copy because that data type is - # NamedTuple's are immutable. - rows = [ - tuple( - sanitize_func(val) - for sanitize_func, val in zip(sanitization_functions, row) - ) - for row in rows - ] + if columns_to_sanitize: + # At least 1 column has to be sanitized. + + def identity(x: Any) -> Any: + return x + + # Use the identity function if the column type doesn't need to be + # sanitized. + sanitization_functions: List[SanitizeFunc] = [ + identity for _ in range(len(cursor.description)) + ] + for info in columns_to_sanitize: + sanitization_functions[info.column_index] = info.sanitize_func + + # pyocient returns a list of NamedTuple objects which represent a + # single row. We have to do this copy because that data type is + # NamedTuple's are immutable. + rows = [ + tuple( + sanitize_func(val) + for sanitize_func, val in zip(sanitization_functions, row) + ) + for row in rows + ] return rows @classmethod