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 2019/04/16 08:57:57 UTC

[GitHub] [incubator-superset] bipinsoniguavus commented on a change in pull request #7048: feat: add Dremio connector support

bipinsoniguavus commented on a change in pull request #7048: feat: add Dremio connector support
URL: https://github.com/apache/incubator-superset/pull/7048#discussion_r275696584
 
 

 ##########
 File path: superset/db_engine_specs.py
 ##########
 @@ -707,8 +707,50 @@ def convert_dttm(cls, target_type, dttm):
     def get_table_names(cls, inspector, schema):
         """Need to disregard the schema for Sqlite"""
         return sorted(inspector.get_table_names())
+        
+# Start Dremio Support
+class DremioEngineSpec(BaseEngineSpec):
+    engine = 'dremio'
+    import sqlalchemy_dremio
 
+    @classmethod
+    def get_schema_names(cls, inspector):
+        schemas = [row[0] for row in inspector.engine.execute('SHOW SCHEMAS')
+                   if not row[0].startswith('_')]
+        return schemas
+
+    @classmethod
+    def get_table_names(cls, schema, inspector):
+        sql = f'SELECT TABLE_NAME FROM INFORMATION_SCHEMA."TABLES" WHERE TABLE_SCHEMA = \'{schema}\''
+        schemas = [row[0] for row in inspector.engine.execute(sql)
+                   if not row[0].startswith('_')]
+        return sorted(schemas)
+
+    @classmethod
+    def get_normalized_column_names(cls, cursor_description):
+        columns = cursor_description if cursor_description else []
+        return [cls.normalize_column_name(col[0]) for col in columns]
+    
+    @staticmethod
+    def normalize_column_name(column_name):
 
 Review comment:
   @villebro Can you please tell me the workaround to fix in code?

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