DiscoverInputSchema
Infers a schema for a SQL-based Kinesis Data Analytics application by evaluating sample records on the specified streaming source (Kinesis data stream or Kinesis Data Firehose delivery stream) or Amazon 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. When you create an application using the Kinesis Data Analytics console, the console uses this operation to infer a schema and show it in the console user interface.
Request Syntax
{
"InputProcessingConfiguration": {
"InputLambdaProcessor": {
"ResourceARN": "string
"
}
},
"InputStartingPositionConfiguration": {
"InputStartingPosition": "string
"
},
"ResourceARN": "string
",
"S3Configuration": {
"BucketARN": "string
",
"FileKey": "string
"
},
"ServiceExecutionRole": "string
"
}
Request Parameters
The request accepts the following data in JSON format.
- InputProcessingConfiguration
-
The InputProcessingConfiguration to use to preprocess the records before discovering the schema of the records.
Type: InputProcessingConfiguration object
Required: No
- InputStartingPositionConfiguration
-
The point at which you want Kinesis Data Analytics to start reading records from the specified streaming source for discovery purposes.
Type: InputStartingPositionConfiguration object
Required: No
- ResourceARN
-
The Amazon Resource Name (ARN) of the streaming source.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 2048.
Pattern:
arn:.*
Required: No
- S3Configuration
-
Specify this parameter to discover a schema from data in an Amazon S3 object.
Type: S3Configuration object
Required: No
- ServiceExecutionRole
-
The ARN of the role that is used to access the streaming source.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 2048.
Pattern:
arn:.*
Required: Yes
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.
- InputSchema
-
The 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
- ParsedInputRecords
-
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
- ProcessedInputRecords
-
The stream data that was modified by the processor specified in the
InputProcessingConfiguration
parameter.Type: Array of strings
- RawInputRecords
-
The raw stream data that was sampled to infer the schema.
Type: Array of strings
Errors
- InvalidArgumentException
-
The specified input parameter value is not valid.
HTTP Status Code: 400
- InvalidRequestException
-
The request JSON is not valid for the operation.
HTTP Status Code: 400
- ResourceProvisionedThroughputExceededException
-
Discovery failed to get a record from the streaming source because of the Kinesis Streams
ProvisionedThroughputExceededException
. For more information, see GetRecordsin the Amazon Kinesis Streams API Reference. HTTP Status Code: 400
- ServiceUnavailableException
-
The service cannot complete the request.
HTTP Status Code: 500
- UnableToDetectSchemaException
-
The data format is not valid. Kinesis Data Analytics cannot detect the schema for the given streaming source.
HTTP Status Code: 400
- UnsupportedOperationException
-
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: