Skip to content

create_data_integration_flow

create_data_integration_flow(
    instance_id: UUID,
    name: DataIntegrationFlowName,
    sources: DataIntegrationFlowSourceList,
    transformation: DataIntegrationFlowTransformation,
    target: DataIntegrationFlowTarget,
    *,
    config_overrides: Optional[SupplyChainClientConfig] = None,
    tags: Optional[TagMap] = None,
) -> CreateDataIntegrationFlowResponse

Enables you to programmatically create a data pipeline to ingest data from source systems such as Amazon S3 buckets, to a predefined Amazon Web Services Supply Chain dataset (product, inbound_order) or a temporary dataset along with the data transformation query provided with the API.

Parameters:

Raises:

Examples:

Successful CreateDataIntegrationFlow for s3 to dataset flow

>>> client.create_data_integration_flow(instance_id='8850c54e-e187-4fa7-89d4-6370f165174d', name='testStagingFlow', sources=[{'sourceType': 'S3', 'sourceName': 'testSourceName', 's3Source': {'bucketName': 'aws-supply-chain-data-b8c7bb28-a576-4334-b481-6d6e8e47371f', 'prefix': 'example-prefix'}}], transformation={'transformationType': 'SQL', 'sqlTransformation': {'query': 'SELECT * FROM testSourceName'}}, target={'targetType': 'DATASET', 'datasetTarget': {'datasetIdentifier': 'arn:aws:scn:us-east-1:123456789012:instance/8850c54e-e187-4fa7-89d4-6370f165174d/namespaces/default/datasets/my_staging_dataset'}}, tags={'tagKey1': 'tagValue1'})
Successful CreateDataIntegrationFlow for dataset to dataset flow
>>> client.create_data_integration_flow(instance_id='8850c54e-e187-4fa7-89d4-6370f165174d', name='trading-partner', sources=[{'sourceType': 'DATASET', 'sourceName': 'testSourceName1', 'datasetSource': {'datasetIdentifier': 'arn:aws:scn:us-east-1:123456789012:instance/8850c54e-e187-4fa7-89d4-6370f165174d/namespaces/default/datasets/my_staging_dataset1'}}, {'sourceType': 'DATASET', 'sourceName': 'testSourceName2', 'datasetSource': {'datasetIdentifier': 'arn:aws:scn:us-east-1:123456789012:instance/8850c54e-e187-4fa7-89d4-6370f165174d/namespaces/default/datasets/my_staging_dataset2'}}], transformation={'transformationType': 'SQL', 'sqlTransformation': {'query': 'SELECT S1.id AS id, S1.poc_org_unit_description AS description, S1.company_id AS company_id, S1.tpartner_type AS tpartner_type, S1.geo_id AS geo_id, S1.eff_start_date AS eff_start_date, S1.eff_end_date AS eff_end_date FROM testSourceName1 AS S1 LEFT JOIN testSourceName2 as S2 ON S1.id=S2.id'}}, target={'targetType': 'DATASET', 'datasetTarget': {'datasetIdentifier': 'arn:aws:scn:us-east-1:123456789012:instance/8850c54e-e187-4fa7-89d4-6370f165174d/namespaces/asc/datasets/trading_partner', 'options': {'loadType': 'REPLACE', 'dedupeRecords': True, 'dedupeStrategy': {'type': 'FIELD_PRIORITY', 'fieldPriority': {'fields': [{'name': 'eff_start_date', 'sortOrder': 'DESC'}]}}}}}, tags={'tagKey1': 'tagValue1'})
Source code in docs_src/capo_supplychain/_services/supply_chain.py
def create_data_integration_flow(
    self,
    instance_id: "capo_supplychain.types.uuid.UUID",
    name: "capo_supplychain.types.data_integration_flow_name.DataIntegrationFlowName",
    sources: "capo_supplychain.types.data_integration_flow_source_list.DataIntegrationFlowSourceList",
    transformation: "capo_supplychain.types.data_integration_flow_transformation.DataIntegrationFlowTransformation",
    target: "capo_supplychain.types.data_integration_flow_target.DataIntegrationFlowTarget",
    *,
    config_overrides: Optional[SupplyChainClientConfig] = None,
    tags: Optional["capo_supplychain.types.tag_map.TagMap"] = None,
) -> "capo_supplychain.types.create_data_integration_flow_response.CreateDataIntegrationFlowResponse":
    """<p>Enables you to programmatically create a data pipeline to ingest data from source systems such as Amazon S3 buckets, to a predefined Amazon Web Services Supply Chain dataset (product, inbound_order) or a temporary dataset along with the data transformation query provided with the API.</p>

    Args:
        instance_id: <p>The Amazon Web Services Supply Chain instance identifier.</p>
        name: <p>Name of the DataIntegrationFlow.</p>
        sources: <p>The source configurations for DataIntegrationFlow.</p>
        transformation: <p>The transformation configurations for DataIntegrationFlow.</p>
        target: <p>The target configurations for DataIntegrationFlow.</p>
        tags: <p>The tags of the DataIntegrationFlow to be created</p>

    Raises:
        capo_supplychain.errors.access_denied_exception.AccessDeniedException: <p>You do not have the required privileges to perform this action.</p>
        capo_supplychain.errors.conflict_exception.ConflictException: <p>Updating or deleting a resource can cause an inconsistent state.</p>
        capo_supplychain.errors.internal_server_exception.InternalServerException: <p>Unexpected error during processing of request.</p>
        capo_supplychain.errors.resource_not_found_exception.ResourceNotFoundException: <p>Request references a resource which does not exist.</p>
        capo_supplychain.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Request would cause a service quota to be exceeded.</p>
        capo_supplychain.errors.throttling_exception.ThrottlingException: <p>Request was denied due to request throttling.</p>
        capo_supplychain.errors.validation_exception.ValidationException: <p>The input does not satisfy the constraints specified by an AWS service.</p>
        capo_supplychain.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Successful CreateDataIntegrationFlow for s3 to dataset flow

        >>> client.create_data_integration_flow(instance_id='8850c54e-e187-4fa7-89d4-6370f165174d', name='testStagingFlow', sources=[{'sourceType': 'S3', 'sourceName': 'testSourceName', 's3Source': {'bucketName': 'aws-supply-chain-data-b8c7bb28-a576-4334-b481-6d6e8e47371f', 'prefix': 'example-prefix'}}], transformation={'transformationType': 'SQL', 'sqlTransformation': {'query': 'SELECT * FROM testSourceName'}}, target={'targetType': 'DATASET', 'datasetTarget': {'datasetIdentifier': 'arn:aws:scn:us-east-1:123456789012:instance/8850c54e-e187-4fa7-89d4-6370f165174d/namespaces/default/datasets/my_staging_dataset'}}, tags={'tagKey1': 'tagValue1'})
        Successful CreateDataIntegrationFlow for dataset to dataset flow

        >>> client.create_data_integration_flow(instance_id='8850c54e-e187-4fa7-89d4-6370f165174d', name='trading-partner', sources=[{'sourceType': 'DATASET', 'sourceName': 'testSourceName1', 'datasetSource': {'datasetIdentifier': 'arn:aws:scn:us-east-1:123456789012:instance/8850c54e-e187-4fa7-89d4-6370f165174d/namespaces/default/datasets/my_staging_dataset1'}}, {'sourceType': 'DATASET', 'sourceName': 'testSourceName2', 'datasetSource': {'datasetIdentifier': 'arn:aws:scn:us-east-1:123456789012:instance/8850c54e-e187-4fa7-89d4-6370f165174d/namespaces/default/datasets/my_staging_dataset2'}}], transformation={'transformationType': 'SQL', 'sqlTransformation': {'query': 'SELECT S1.id AS id, S1.poc_org_unit_description AS description, S1.company_id AS company_id, S1.tpartner_type AS tpartner_type, S1.geo_id AS geo_id, S1.eff_start_date AS eff_start_date, S1.eff_end_date AS eff_end_date FROM testSourceName1 AS S1 LEFT JOIN testSourceName2 as S2 ON S1.id=S2.id'}}, target={'targetType': 'DATASET', 'datasetTarget': {'datasetIdentifier': 'arn:aws:scn:us-east-1:123456789012:instance/8850c54e-e187-4fa7-89d4-6370f165174d/namespaces/asc/datasets/trading_partner', 'options': {'loadType': 'REPLACE', 'dedupeRecords': True, 'dedupeStrategy': {'type': 'FIELD_PRIORITY', 'fieldPriority': {'fields': [{'name': 'eff_start_date', 'sortOrder': 'DESC'}]}}}}}, tags={'tagKey1': 'tagValue1'})
    """

    def _handler(
        req: "OperationRequest[capo_supplychain.types.create_data_integration_flow_request.CreateDataIntegrationFlowRequest]",
    ) -> OperationResponse[
        "capo_supplychain.types.create_data_integration_flow_response.CreateDataIntegrationFlowResponse"
    ]:
        import capo_supplychain._operations.galaxy_public_api_gateway.create_data_integration_flow

        output, http_response = (
            capo_supplychain._operations.galaxy_public_api_gateway.create_data_integration_flow.create_data_integration_flow(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_supplychain.types.create_data_integration_flow_request.CreateDataIntegrationFlowRequest",
    ) -> dict[str, Any]:
        import capo_supplychain.types.create_data_integration_flow_request

        return capo_supplychain.types.create_data_integration_flow_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateDataIntegrationFlow", redact_input=_redact_input),
    )
    input_: capo_supplychain.types.create_data_integration_flow_request.CreateDataIntegrationFlowRequest = {
        "instance_id": instance_id,
        "name": name,
        "sources": sources,
        "transformation": transformation,
        "target": target,
    }
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output