Преглед изворни кода

HUE-6005 [librdbms] Col details is empty for other than Hive and Impala

Adrian Yavorskyy пре 8 година
родитељ
комит
c646b5b

+ 5 - 1
desktop/libs/notebook/src/notebook/connectors/rdbms.py

@@ -137,10 +137,14 @@ class RdbmsApi(Api):
       for t in assist.get_tables(database):
         tables_meta.append({'name': t, 'type': 'Table', 'comment': ''})
       response['tables_meta'] = tables_meta
-    else:
+    elif column is None:
       columns = assist.get_columns(database, table)
       response['columns'] = [col['name'] for col in columns]
       response['extended_columns'] = columns
+    else:
+      columns = assist.get_columns(database, table)
+      response['name'] = next((col['name'] for col in columns if column == col['name']), '')
+      response['type'] = next((col['type'] for col in columns if column == col['name']), '')
 
     response['status'] = 0
     return response

+ 1 - 0
desktop/libs/notebook/src/notebook/urls.py

@@ -93,6 +93,7 @@ urlpatterns += patterns('notebook.api',
   # SQLite
   url(r'^api/autocomplete//?(?P<server>[\w_\-/]+)/(?P<database>[\w._\-0-9]+)/?$', 'autocomplete', name='api_autocomplete_tables'),
   url(r'^api/autocomplete//?(?P<server>[\w_\-/]+)/(?P<database>[\w._\-0-9]+)/(?P<table>\w+)/?$', 'autocomplete', name='api_autocomplete_columns'),
+  url(r'^api/autocomplete//?(?P<server>[\w_\-/]+)/(?P<database>[\w._\-0-9]+)/(?P<table>\w+)/(?P<column>\w+)/?$', 'autocomplete', name='api_autocomplete_column'),
   url(r'^api/sample/(?P<server>[\w_\-/]+)/(?P<database>[\w._\-0-9]+)/(?P<table>\w+)/?$', 'get_sample_data', name='api_sample_data'),
   url(r'^api/sample/(?P<server>[\w_\-/]+)/(?P<database>[\w._\-0-9]+)/(?P<table>\w+)/(?P<column>\w+)/?$', 'get_sample_data', name='api_sample_data_column'),
 )