Эх сурвалжийг харах

HUE-8758 [sqlalchemy] Handle when column metadata if of Column type

Happens with PostgreSQL
Romain 5 жил өмнө
parent
commit
3d719de968

+ 6 - 6
desktop/libs/notebook/src/notebook/connectors/sql_alchemy.py

@@ -306,14 +306,14 @@ class SqlAlchemyApi(Api):
     if table and operation != 'hello':
       columns = assist.get_columns(database, table)
       response['full_headers'] = [{
-        'name': col.get('name'),
-        'type': str(col.get('type')),
-        'comment': ''
-      } for col in columns
-    ]
+          'name': col.get('name'),
+          'type': str(col.get('type')),
+          'comment': ''
+        } for col in columns
+      ]
     elif metadata:
       response['full_headers'] = [{
-        'name': col[0] if type(col) is dict or type(col) is tuple else col,
+        'name': col[0] if type(col) is dict or type(col) is tuple else col.name if hasattr(col, 'name') else col,
         'type': 'STRING_TYPE',
         'comment': ''
       } for col in metadata