Parcourir la source

[ksql] Adding ksqDB SQL examples

./build/env/bin/hue samples_setup --username=hue --dialect=ksql
Romain Rigaux il y a 5 ans
Parent
commit
a143fe3e5c

+ 1 - 1
apps/about/src/about/templates/admin_wizard.mako

@@ -109,7 +109,7 @@ ${ layout.menubar(section='quick_start') }
 
               % if has_connectors():
                 <!-- ko foreach: connectors -->
-                  <!-- ko if: ['hive', 'impala', 'mysql', 'postgresql', 'presto', 'phoenix', 'flink'].indexOf(dialect) != -1 -->
+                  <!-- ko if: ['hive', 'impala', 'mysql', 'postgresql', 'presto', 'phoenix', 'flink', 'ksql'].indexOf(dialect) != -1 -->
                   <li>
                     <a href="javascript:void(0)" data-bind="click: $root.installConnectorDataExample">
                       <i class="fa fa-download"></i> <span data-bind="text: name"></span>

+ 20 - 0
apps/beeswax/data/queries.json

@@ -261,5 +261,25 @@
       "file_resources": [],
       "settings": []
     }
+  },
+  {
+    "name": "Query and live display a live stream of data",
+    "desc": "List Kafka topics or a user table backed by a Kafka topic",
+    "dialects": ["ksql"],
+    "type": "2",
+    "auto_load_only": false,
+    "data": {
+      "query": {
+        "query": "\nSHOW TOPICS\n;\n\n\nCREATE STREAM user_behavior (\n  user_id BIGINT,\n  item_id BIGINT,\n  category_id BIGINT,\n  behavior STRING,\n  ts STRING\n) WITH (kafka_topic='user_behavior', value_format='json', partitions=1)\n;\n\n\nSELECT *\nFROM user_behavior\nEMIT CHANGES\nLIMIT 30\n;\n\n\nINSERT INTO user_behavior (\n  user_id ,\n  item_id ,\n  category_id ,\n  behavior ,\n  ts\n)\nVALUES\n(1, 10, 20, 'buy', '1602998392')\n;\n",
+        "type": 0,
+        "email_notify": false,
+        "is_parameterized": false,
+        "database": ""
+      },
+      "functions": [],
+      "VERSION": "0.4.1",
+      "file_resources": [],
+      "settings": []
+    }
   }
 ]

+ 9 - 0
apps/beeswax/data/tables.json

@@ -26,4 +26,13 @@
     "dialects": ["flink"],
     "transactional": true
   }
+  ,
+  {
+    "data_file": null,
+    "create_sql": "CREATE STREAM user_behavior (\n  user_id BIGINT,\n  item_id BIGINT,\n  category_id BIGINT,\n  behavior STRING,\n  ts STRING\n) WITH (kafka_topic='user_behavior', value_format='json', partitions=1)\n",
+    "insert_sql": null,
+    "table_name": "user_behavior",
+    "dialects": ["ksql"],
+    "transactional": true
+  }
 ]