Bläddra i källkod

HUE-9280 [flink] List tables of tables with underscore in the name

Romain 5 år sedan
förälder
incheckning
c283218fc3

+ 4 - 2
desktop/libs/notebook/src/notebook/api.py

@@ -728,8 +728,10 @@ def autocomplete(request, server=None, database=None, table=None, column=None, n
   try:
     autocomplete_data = get_api(request, snippet).autocomplete(snippet, database, table, column, nested)
     response.update(autocomplete_data)
-  except QueryExpired:
-    pass
+    if has_missing_ssh(message=response['message']):
+      raise QueryError('Missing SSH tunnel')
+  except QueryExpired as e:
+    LOG.warn('Expired query seen: %s' % e)
 
   response['status'] = 0
 

+ 1 - 9
desktop/libs/notebook/src/notebook/connectors/flink_sql.py

@@ -137,15 +137,7 @@ class FlinkSqlApi(Api):
       if database is None:
         response['databases'] = self.show_databases()
       elif table is None:
-        if database == 'tables':
-          response['tables_meta'] = self.show_tables(database)
-        elif database == 'topics':
-          response['tables_meta'] = self.db.show_topics()
-        elif database == 'streams':
-          response['tables_meta'] = [
-            {'name': t['name'], 'type': t['type'], 'comment': 'Topic: %(topic)s Format: %(format)s' % t}
-            for t in self.db.show_streams()
-          ]
+        response['tables_meta'] = self.show_tables(database)
       elif column is None:
         columns = self.db.get_columns(table)
         response['columns'] = [col['name'] for col in columns]

+ 6 - 6
desktop/libs/notebook/src/notebook/urls.py

@@ -75,12 +75,12 @@ urlpatterns += [
 urlpatterns += [
   # HS2, RDBMS, JDBC
   url(r'^api/autocomplete/?$', notebook_api.autocomplete, name='api_autocomplete_databases'),
-  url(r'^api/autocomplete/(?P<database>\w+)/?$', notebook_api.autocomplete, name='api_autocomplete_tables'),
-  url(r'^api/autocomplete/(?P<database>\w+)/(?P<table>[\w_\-]+)/?$', notebook_api.autocomplete, name='api_autocomplete_columns'),
-  url(r'^api/autocomplete/(?P<database>\w+)/(?P<table>[\w_\-]+)/(?P<column>\w+)/?$', notebook_api.autocomplete, name='api_autocomplete_column'),
-  url(r'^api/autocomplete/(?P<database>\w+)/(?P<table>[\w_\-]+)/(?P<column>\w+)/(?P<nested>.+)/?$', notebook_api.autocomplete, name='api_autocomplete_nested'),
-  url(r'^api/sample/(?P<database>\w+)/(?P<table>[\w_\-]+)/?$', notebook_api.get_sample_data, name='api_sample_data'),
-  url(r'^api/sample/(?P<database>\w+)/(?P<table>[\w_\-]+)/(?P<column>\w+)/?$', notebook_api.get_sample_data, name='api_sample_data_column'),
+  url(r'^api/autocomplete/(?P<database>[\w_]+)/?$', notebook_api.autocomplete, name='api_autocomplete_tables'),
+  url(r'^api/autocomplete/(?P<database>[\w_]+)/(?P<table>[\w_\-]+)/?$', notebook_api.autocomplete, name='api_autocomplete_columns'),
+  url(r'^api/autocomplete/(?P<database>[\w_]+)/(?P<table>[\w_\-]+)/(?P<column>\w+)/?$', notebook_api.autocomplete, name='api_autocomplete_column'),
+  url(r'^api/autocomplete/(?P<database>[\w_]+)/(?P<table>[\w_\-]+)/(?P<column>\w+)/(?P<nested>.+)/?$', notebook_api.autocomplete, name='api_autocomplete_nested'),
+  url(r'^api/sample/(?P<database>[\w_]+)/(?P<table>[\w_\-]+)/?$', notebook_api.get_sample_data, name='api_sample_data'),
+  url(r'^api/sample/(?P<database>[\w_]+)/(?P<table>[\w_\-]+)/(?P<column>\w+)/?$', notebook_api.get_sample_data, name='api_sample_data_column'),
 
   # SQLite
   url(r'^api/autocomplete//?(?P<server>[\w_\-/]+)/(?P<database>[\w._\-0-9]+)/?$', notebook_api.autocomplete, name='api_autocomplete_tables'),