Просмотр исходного кода

HUE-8888 [docs] Adding basic SQL autocomplete API

Romain 5 лет назад
Родитель
Сommit
0ed92ba528

+ 1 - 1
README.md

@@ -8,7 +8,7 @@
 Query. Explore. Share.
 Query. Explore. Share.
 ----------------------
 ----------------------
 
 
-Hue is a mature open source SQL Assistant for [querying](https://docs.gethue.com/user/querying/) [Databases & Data Warehouses](https://docs.gethue.com/administrator/configuration/connectors/) and collaborating: [gethue.com](http://gethue.com)
+Hue is a mature open source SQL Assistant for [querying](https://docs.gethue.com/user/querying/) any [Databases & Data Warehouses](https://docs.gethue.com/administrator/configuration/connectors/) and collaborating: [gethue.com](http://gethue.com)
 
 
 Many companies and organizations use Hue to quickly answer questions via self-service querying e.g.:
 Many companies and organizations use Hue to quickly answer questions via self-service querying e.g.:
 
 

+ 53 - 2
docs/docs-site/content/developer/api/_index.md

@@ -12,7 +12,7 @@ Hue can be accessed directly via a Python Shell or by its REST API. Some compone
 
 
 The parser is running on the client side and comes with just a few MBs of Javascript that are cached by the browser. This provides a very reactive experience to the end user and allow to import it as a module.
 The parser is running on the client side and comes with just a few MBs of Javascript that are cached by the browser. This provides a very reactive experience to the end user and allow to import it as a module.
 
 
-While the dynamic content like the list of tables, columns is obviously fetched via a remote endpoint, all the SQL knowledge of the statements is available.
+While the dynamic content like the list of tables, columns is obviously fetched via a [remote endpoints](#sql-querying), all the SQL knowledge of the statements is available.
 
 
 See the currently shipped [SQL dialects](https://github.com/cloudera/hue/tree/master/desktop/core/src/desktop/js/parse/sql).
 See the currently shipped [SQL dialects](https://github.com/cloudera/hue/tree/master/desktop/core/src/desktop/js/parse/sql).
 
 
@@ -291,6 +291,57 @@ Adding/updating a comment with the dummy backend:
     });
     });
 
 
 ### SQL Querying
 ### SQL Querying
+
+#### Listing Databases
+
+    $.post("/notebook/api/autocomplete/", {
+      "snippet": ko.mapping.toJSON({
+          type: "hive"
+      })
+    }, function(data) {
+      console.log(ko.mapping.toJSON(data));
+    });
+
+#### Listing Tables
+
+    $.post("/notebook/api/autocomplete/<DB>", {
+      "snippet": ko.mapping.toJSON({
+          type: "hive"
+      })
+    }, function(data) {
+      console.log(ko.mapping.toJSON(data));
+    });
+
+#### Table details and Columns
+
+    $.post("/notebook/api/autocomplete/<DB>/<TABLE>", {
+      "snippet": ko.mapping.toJSON({
+          type: "hive"
+      })
+    }, function(data) {
+      console.log(ko.mapping.toJSON(data));
+    });
+
+#### Column details
+
+    $.post("/notebook/api/autocomplete/<DB>/<TABLE>/<COL1>", {
+      "snippet": ko.mapping.toJSON({
+          type: "hive"
+      })
+    }, function(data) {
+      console.log(ko.mapping.toJSON(data));
+    });
+
+For nested columns:
+
+    $.post("/notebook/api/autocomplete/<DB>/<TABLE>/<COL1>/<COL2>", {
+      "snippet": ko.mapping.toJSON({
+          type: "hive"
+      })
+    }, function(data) {
+      console.log(ko.mapping.toJSON(data));
+    });
+
 ### SQL Risk Optimization
 ### SQL Risk Optimization
 ### Data Browsing
 ### Data Browsing
 ### Workflow scheduling
 ### Workflow scheduling
@@ -300,7 +351,7 @@ Adding/updating a comment with the dummy backend:
 * [Hue API: Execute some builtin or shell commands](http://gethue.com/hue-api-execute-some-builtin-commands/).
 * [Hue API: Execute some builtin or shell commands](http://gethue.com/hue-api-execute-some-builtin-commands/).
 * [How to manage the Hue database with the shell](http://gethue.com/how-to-manage-the-hue-database-with-the-shell/).
 * [How to manage the Hue database with the shell](http://gethue.com/how-to-manage-the-hue-database-with-the-shell/).
 
 
-### How to count documents of a user
+### Count the documents of a user
 
 
 On the command line:
 On the command line:
 
 

+ 4 - 0
docs/docs-site/content/developer/parsers/_index.md

@@ -329,3 +329,7 @@ And cf. above [prerequisites](#prerequisites), any interpreter snippet with `ksq
         interface=ksql
         interface=ksql
 
 
 Note: after [HUE-8758](https://issues.cloudera.org/browse/HUE-8758) we will be able to have multiple interpreters on the same dialect (e.g. pointing to two different databases of the same type).
 Note: after [HUE-8758](https://issues.cloudera.org/browse/HUE-8758) we will be able to have multiple interpreters on the same dialect (e.g. pointing to two different databases of the same type).
+
+## API
+
+Looking at importing the parser in your own apps? This is described in the [API section](/developer/api/#sql-autocompletion).