我正在通过dynamoDBTrigger
的调用将数据写入运动学流。该流被配置为运动分析应用程序的输入流。我在kinesis流上配置了一个lambda预处理器,用于记录写入流中的数据。但是,在“分析”应用程序的“源”选项卡上,出现消息源流中没有行。这些行不在应用程序内SQL流中创建。
我正在使用Node并使用serverless.yml
文件部署服务。这是配置-
RecordKinesisAnalyticsApp:
Type: AWS::KinesisAnalytics::Application
Properties:
ApplicationName: RecordKinesisAnalyticsApp
ApplicationDescription: RecordKinesisAnalyticsApp
ApplicationCode: ${file(./serverless/metadataQueries.yml):AnalyticsQuery_1}
Inputs:
- NamePrefix: "RecordPrefix"
InputSchema:
RecordColumns:
- Name: "USER_ID"
SqlType: "VARCHAR(20)"
Mapping: "$._userId"
- Name: "ANXIETY"
SqlType: "INTEGER"
Mapping: "$.anxiety"
RecordEncoding: "UTF-8"
RecordFormat:
RecordFormatType: "JSON"
KinesisStreamsInput:
ResourceARN:
Fn::GetAtt:
- RecordKinesisInputStream
- Arn
RoleARN: arn:aws:iam::xxxxxxxxxxx:role/service-role/kinesis-analytics-KinesisDemo-us-east-1
这是分析查询-
CREATE OR REPLACE STREAM "DESTINATION_SQL_STREAM " (USER_ID VARCHAR(20), ANXIETY INTEGER);
CREATE OR REPLACE PUMP "STREAM_PUMP" AS INSERT INTO "DESTINATION_SQL_STREAM"
SELECT STREAM USER_ID, ANXIETY
FROM "RecordPrefix_001"
WHERE ANXIETY >= 0;