AWS Kinesis Analytics 不接收有关实时分析的数据
AWS Kinesis Analytics doesn't receive data on Real-time analytics
我正在尝试实施 AWS Kinesis Analytics 但没有成功。我已经成功实施了 Kineses Stream、Kinesis Analytics 架构。当我打开实时分析(SQL 编辑器)时,我在选项卡 "Source data":
上有这个
在选项卡 "Real-time analytics" 上,我只得到 "No rows have arrived yet.":
这是我的 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
问题是我忘记了查询语句末尾的 ;
。
改为:
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";
我正在尝试实施 AWS Kinesis Analytics 但没有成功。我已经成功实施了 Kineses Stream、Kinesis Analytics 架构。当我打开实时分析(SQL 编辑器)时,我在选项卡 "Source data":
上有这个在选项卡 "Real-time analytics" 上,我只得到 "No rows have arrived yet.":
这是我的 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
问题是我忘记了查询语句末尾的 ;
。
改为:
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";