DiscoverInputSchema - Amazon Kinesis Data Analytics for SQL Applications Developer Guide
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

For new projects, we recommend that you use the new Managed Service for Apache Flink Studio over Kinesis Data Analytics for SQL Applications. Managed Service for Apache Flink Studio combines ease of use with advanced analytical capabilities, enabling you to build sophisticated stream processing applications in minutes.



This documentation is for version 1 of the Amazon Kinesis Data Analytics API, which only supports SQL applications. Version 2 of the API supports SQL and Java applications. For more information about version 2, see Amazon Kinesis Data Analytics API V2 Documentation.

Infers a schema by evaluating sample records on the specified streaming source (Amazon Kinesis stream or Amazon Kinesis Firehose delivery stream) or S3 object. In the response, the operation returns the inferred schema and also the sample records that the operation used to infer the schema.

You can use the inferred schema when configuring a streaming source for your application. For conceptual information, see Configuring Application Input. Note that when you create an application using the Amazon Kinesis Analytics console, the console uses this operation to infer a schema and show it in the console user interface.

This operation requires permissions to perform the kinesisanalytics:DiscoverInputSchema action.

Request Syntax

{ "InputProcessingConfiguration": { "InputLambdaProcessor": { "ResourceARN": "string", "RoleARN": "string" } }, "InputStartingPositionConfiguration": { "InputStartingPosition": "string" }, "ResourceARN": "string", "RoleARN": "string", "S3Configuration": { "BucketARN": "string", "FileKey": "string", "RoleARN": "string" } }

Request Parameters

The request accepts the following data in JSON format.


The InputProcessingConfiguration to use to preprocess the records before discovering the schema of the records.

Type: InputProcessingConfiguration object

Required: No


Point at which you want Amazon Kinesis Analytics to start reading records from the specified streaming source discovery purposes.

Type: InputStartingPositionConfiguration object

Required: No


Amazon Resource Name (ARN) of the streaming source.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 2048.

Pattern: arn:.*

Required: No


ARN of the IAM role that Amazon Kinesis Analytics can assume to access the stream on your behalf.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 2048.

Pattern: arn:.*

Required: No


Specify this parameter to discover a schema from data in an Amazon S3 object.

Type: S3Configuration object

Required: No

Response Syntax

{ "InputSchema": { "RecordColumns": [ { "Mapping": "string", "Name": "string", "SqlType": "string" } ], "RecordEncoding": "string", "RecordFormat": { "MappingParameters": { "CSVMappingParameters": { "RecordColumnDelimiter": "string", "RecordRowDelimiter": "string" }, "JSONMappingParameters": { "RecordRowPath": "string" } }, "RecordFormatType": "string" } }, "ParsedInputRecords": [ [ "string" ] ], "ProcessedInputRecords": [ "string" ], "RawInputRecords": [ "string" ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.


Schema inferred from the streaming source. It identifies the format of the data in the streaming source and how each data element maps to corresponding columns in the in-application stream that you can create.

Type: SourceSchema object


An array of elements, where each element corresponds to a row in a stream record (a stream record can have more than one row).

Type: Array of arrays of strings


Stream data that was modified by the processor specified in the InputProcessingConfiguration parameter.

Type: Array of strings


Raw stream data that was sampled to infer the schema.

Type: Array of strings



Specified input parameter value is invalid.

HTTP Status Code: 400


Discovery failed to get a record from the streaming source because of the Amazon Kinesis Streams ProvisionedThroughputExceededException. For more information, see GetRecords in the Amazon Kinesis Streams API Reference.

HTTP Status Code: 400


The service is unavailable. Back off and retry the operation.

HTTP Status Code: 500


Data format is not valid. Amazon Kinesis Analytics is not able to detect schema for the given streaming source.

HTTP Status Code: 400


The request was rejected because a specified parameter is not supported or a specified resource is not valid for this operation.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: