You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/11/07 10:15:47 UTC

[GitHub] cooleasyhan closed pull request #3775: Fix issue: Oracle backend: pandas Exception : KeyError #953

cooleasyhan closed pull request #3775: Fix issue: Oracle backend: pandas Exception : KeyError #953
URL: https://github.com/apache/incubator-superset/pull/3775
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/superset/connectors/sqla/models.py b/superset/connectors/sqla/models.py
index 17c3fd5464..1dd10a6c09 100644
--- a/superset/connectors/sqla/models.py
+++ b/superset/connectors/sqla/models.py
@@ -569,6 +569,19 @@ def query(self, query_obj):
             error_message = (
                 self.database.db_engine_spec.extract_error_message(e))
 
+        def cols_adjustment(df):
+            _tmp = []
+            for col in df.columns:
+                if col not in query_obj['metrics']:
+                    _tmp.append(self.database.db_engine_spec.format_column_name(col))
+                else:
+                    _tmp.append(col)
+
+            df.columns = _tmp
+            return df
+
+        df = cols_adjustment(df)
+
         return QueryResult(
             status=status,
             df=df,
diff --git a/superset/db_engine_specs.py b/superset/db_engine_specs.py
index c5363af2b2..6528579b6e 100644
--- a/superset/db_engine_specs.py
+++ b/superset/db_engine_specs.py
@@ -208,6 +208,10 @@ def get_uri_for_impersonation(cls, uri, impersonate_user, username):
         """
         return uri
 
+    @classmethod
+    def format_column_name(cls, col_name):
+        return col_name
+
 
 class PostgresEngineSpec(BaseEngineSpec):
     engine = 'postgresql'
@@ -949,6 +953,10 @@ def convert_dttm(cls, target_type, dttm):
             """TO_TIMESTAMP('{}', 'YYYY-MM-DD"T"HH24:MI:SS.ff6')"""
         ).format(dttm.isoformat())
 
+    @classmethod
+    def format_column_name(cls, col_name):
+        return col_name.upper()
+
 
 class VerticaEngineSpec(PostgresEngineSpec):
     engine = 'vertica'


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org