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.
Parameters:
-
resource_arn
(Optional[ResourceARN], default:
None
)
–
Amazon Resource Name (ARN) of the streaming source.
-
role_arn
(Optional[RoleARN], default:
None
)
–
ARN of the IAM role that Amazon Kinesis Analytics can assume to access the stream on your behalf.
-
input_starting_position_configuration
(Optional[InputStartingPositionConfiguration], default:
None
)
–
Point at which you want Amazon Kinesis Analytics to start reading records from the specified streaming source discovery purposes.
-
s3_configuration
(Optional[S3Configuration], default:
None
)
–
Specify this parameter to discover a schema from data in an Amazon S3 object.
-
input_processing_configuration
(Optional[InputProcessingConfiguration], default:
None
)
–
Raises:
Source code in docs_src/capo_kinesis_analytics/_services/kinesis_analytics.py
| def discover_input_schema(
self,
*,
config_overrides: Optional[KinesisAnalyticsClientConfig] = None,
resource_arn: Optional[
"capo_kinesis_analytics.types.resource_arn.ResourceARN"
] = None,
role_arn: Optional["capo_kinesis_analytics.types.role_arn.RoleARN"] = None,
input_starting_position_configuration: Optional[
"capo_kinesis_analytics.types.input_starting_position_configuration.InputStartingPositionConfiguration"
] = None,
s3_configuration: Optional[
"capo_kinesis_analytics.types.s3_configuration.S3Configuration"
] = None,
input_processing_configuration: Optional[
"capo_kinesis_analytics.types.input_processing_configuration.InputProcessingConfiguration"
] = None,
) -> "capo_kinesis_analytics.types.discover_input_schema_response.DiscoverInputSchemaResponse":
"""<note> <p>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 <a href="/kinesisanalytics/latest/apiv2/Welcome.html">Amazon Kinesis Data Analytics API V2 Documentation</a>.</p> </note> <p>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.</p> <p> You can use the inferred schema when configuring a streaming source for your application. For conceptual information, see <a href="https://docs.aws.amazon.com/kinesisanalytics/latest/dev/how-it-works-input.html">Configuring Application Input</a>. 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. </p> <p> This operation requires permissions to perform the <code>kinesisanalytics:DiscoverInputSchema</code> action. </p>
Args:
resource_arn: <p>Amazon Resource Name (ARN) of the streaming source.</p>
role_arn: <p>ARN of the IAM role that Amazon Kinesis Analytics can assume to access the stream on your behalf.</p>
input_starting_position_configuration: <p>Point at which you want Amazon Kinesis Analytics to start reading records from the specified streaming source discovery purposes.</p>
s3_configuration: <p>Specify this parameter to discover a schema from data in an Amazon S3 object.</p>
input_processing_configuration: <p>The <a href="https://docs.aws.amazon.com/kinesisanalytics/latest/dev/API_InputProcessingConfiguration.html">InputProcessingConfiguration</a> to use to preprocess the records before discovering the schema of the records.</p>
Raises:
capo_kinesis_analytics.errors.invalid_argument_exception.InvalidArgumentException: <p>Specified input parameter value is invalid.</p>
capo_kinesis_analytics.errors.resource_provisioned_throughput_exceeded_exception.ResourceProvisionedThroughputExceededException: <p>Discovery failed to get a record from the streaming source because of the Amazon Kinesis Streams ProvisionedThroughputExceededException. For more information, see <a href="https://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetRecords.html">GetRecords</a> in the Amazon Kinesis Streams API Reference.</p>
capo_kinesis_analytics.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is unavailable. Back off and retry the operation. </p>
capo_kinesis_analytics.errors.unable_to_detect_schema_exception.UnableToDetectSchemaException: <p>Data format is not valid. Amazon Kinesis Analytics is not able to detect schema for the given streaming source.</p>
capo_kinesis_analytics.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_kinesis_analytics.types.discover_input_schema_request.DiscoverInputSchemaRequest]",
) -> OperationResponse[
"capo_kinesis_analytics.types.discover_input_schema_response.DiscoverInputSchemaResponse"
]:
import capo_kinesis_analytics._operations.kinesis_analytics_20150814.discover_input_schema
output, http_response = (
capo_kinesis_analytics._operations.kinesis_analytics_20150814.discover_input_schema.discover_input_schema(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DiscoverInputSchema")
)
input_: capo_kinesis_analytics.types.discover_input_schema_request.DiscoverInputSchemaRequest = {}
if resource_arn is not None:
input_["resource_arn"] = resource_arn
if role_arn is not None:
input_["role_arn"] = role_arn
if input_starting_position_configuration is not None:
input_["input_starting_position_configuration"] = (
input_starting_position_configuration
)
if s3_configuration is not None:
input_["s3_configuration"] = s3_configuration
if input_processing_configuration is not None:
input_["input_processing_configuration"] = input_processing_configuration
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|