AWS Kinesis Analytics不接收有关实时分析的数据

时间:2019-01-10 14:36:15

标签: amazon-kinesis

我正在尝试实施AWS Kinesis Analytics,但没有成功。我已经成功实现了Kineses Stream,Kinesis Analytics模式。当我打开实时分析(SQL编辑器)时,将其显示在“源数据”选项卡上:

enter image description here

在“实时分析”标签上,我仅收到“尚未到达任何行。”:

enter image description here

这是我的SQL查询:

-- ** Continuous Filter ** 
-- Performs a continuous filter based on a WHERE condition.
--          .----------.   .----------.   .----------.              
--          |  SOURCE  |   |  INSERT  |   |  DESTIN. |              
-- Source-->|  STREAM  |-->| & SELECT |-->|  STREAM  |-->Destination
--          |          |   |  (PUMP)  |   |          |              
--          '----------'   '----------'   '----------'               
-- STREAM (in-application): a continuously updated entity that you can SELECT from and INSERT into like a TABLE
-- PUMP: an entity used to continuously 'SELECT ... FROM' a source STREAM, and INSERT SQL results into an output STREAM
-- Create output stream, which can be used to send to a destination
CREATE OR REPLACE STREAM "DESTINATION_SQL_STREAM" (LASTNAME VARCHAR(8), AGE REAL);
-- Create pump to insert into output 
CREATE OR REPLACE PUMP "STREAM_PUMP" AS INSERT INTO "DESTINATION_SQL_STREAM"
-- Select all columns from source stream
SELECT STREAM LASTNAME, AGE
FROM "SOURCE_SQL_STREAM_001"
-- LIKE compares a string to a string pattern (_ matches all char, % matches substring)
-- SIMILAR TO compares string to a regex, may use ESCAPE
-- WHERE sector SIMILAR TO '%TECH%';

为什么DESTINATION_SQL_STREAM没有收到任何数据?

谢谢!

注意:我每1秒通过以下命令发送一次相同的数据:while sleep 1; do aws kinesis put-record --stream-name Foo --partition-key 123 --data "{\"LASTNAME\": \"Hil3pet\", \"AGE\": 26}"; done

1 个答案:

答案 0 :(得分:1)

问题是我在查询语句的末尾忘记了;

相反:

CREATE OR REPLACE STREAM "DESTINATION_SQL_STREAM" (LASTNAME VARCHAR(8), AGE REAL);
CREATE OR REPLACE PUMP "STREAM_PUMP" AS INSERT INTO "DESTINATION_SQL_STREAM"
SELECT STREAM LASTNAME, AGE
FROM "SOURCE_SQL_STREAM_001"

正确的方法:

CREATE OR REPLACE STREAM "DESTINATION_SQL_STREAM" (LASTNAME VARCHAR(8), AGE REAL);
CREATE OR REPLACE PUMP "STREAM_PUMP" AS INSERT INTO "DESTINATION_SQL_STREAM";
SELECT STREAM LASTNAME, AGE;
FROM "SOURCE_SQL_STREAM_001";