Skip to content

create_data_lake_dataset

create_data_lake_dataset(
    instance_id: UUID,
    namespace: DataLakeNamespaceName,
    name: DataLakeDatasetName,
    *,
    config_overrides: Optional[SupplyChainClientConfig] = None,
    schema: Optional[DataLakeDatasetSchema] = None,
    description: Optional[DataLakeDatasetDescription] = None,
    partition_spec: Optional[DataLakeDatasetPartitionSpec] = None,
    tags: Optional[TagMap] = None,
) -> CreateDataLakeDatasetResponse

Enables you to programmatically create an Amazon Web Services Supply Chain data lake dataset. Developers can create the datasets using their pre-defined or custom schema for a given instance ID, namespace, and dataset name.

Parameters:

Raises:

Examples:

Create an AWS Supply Chain inbound order dataset

>>> client.create_data_lake_dataset(instance_id='1877dd20-dee9-4639-8e99-cb67acf21fe5', namespace='asc', name='inbound_order', description='This is an AWS Supply Chain inbound order dataset', tags={'tagKey1': 'tagValue1', 'tagKey2': 'tagValue2'})
Create a custom dataset
>>> client.create_data_lake_dataset(instance_id='1877dd20-dee9-4639-8e99-cb67acf21fe5', namespace='default', name='my_dataset', description='This is a custom dataset', schema={'name': 'MyDataset', 'fields': [{'name': 'id', 'type': 'INT', 'isRequired': True}, {'name': 'description', 'type': 'STRING', 'isRequired': True}, {'name': 'price', 'type': 'DOUBLE', 'isRequired': False}, {'name': 'creation_time', 'type': 'TIMESTAMP', 'isRequired': False}, {'name': 'quantity', 'type': 'LONG', 'isRequired': False}], 'primaryKeys': [{'name': 'id'}]}, partition_spec={'fields': [{'name': 'creation_time', 'transform': {'type': 'DAY'}}, {'name': 'description', 'transform': {'type': 'IDENTITY'}}]}, tags={'tagKey1': 'tagValue1', 'tagKey2': 'tagValue2'})
Source code in docs_src/capo_supplychain/_services/supply_chain.py
def create_data_lake_dataset(
    self,
    instance_id: "capo_supplychain.types.uuid.UUID",
    namespace: "capo_supplychain.types.data_lake_namespace_name.DataLakeNamespaceName",
    name: "capo_supplychain.types.data_lake_dataset_name.DataLakeDatasetName",
    *,
    config_overrides: Optional[SupplyChainClientConfig] = None,
    schema: Optional[
        "capo_supplychain.types.data_lake_dataset_schema.DataLakeDatasetSchema"
    ] = None,
    description: Optional[
        "capo_supplychain.types.data_lake_dataset_description.DataLakeDatasetDescription"
    ] = None,
    partition_spec: Optional[
        "capo_supplychain.types.data_lake_dataset_partition_spec.DataLakeDatasetPartitionSpec"
    ] = None,
    tags: Optional["capo_supplychain.types.tag_map.TagMap"] = None,
) -> "capo_supplychain.types.create_data_lake_dataset_response.CreateDataLakeDatasetResponse":
    """<p>Enables you to programmatically create an Amazon Web Services Supply Chain data lake dataset. Developers can create the datasets using their pre-defined or custom schema for a given instance ID, namespace, and dataset name.</p>

    Args:
        instance_id: <p>The Amazon Web Services Supply Chain instance identifier.</p>
        namespace: <p>The namespace of the dataset, besides the custom defined namespace, every instance comes with below pre-defined namespaces:</p> <ul> <li> <p> <b>asc</b> - For information on the Amazon Web Services Supply Chain supported datasets see <a href="https://docs.aws.amazon.com/aws-supply-chain/latest/userguide/data-model-asc.html">https://docs.aws.amazon.com/aws-supply-chain/latest/userguide/data-model-asc.html</a>.</p> </li> <li> <p> <b>default</b> - For datasets with custom user-defined schemas.</p> </li> </ul>
        name: <p>The name of the dataset. For <b>asc</b> name space, the name must be one of the supported data entities under <a href="https://docs.aws.amazon.com/aws-supply-chain/latest/userguide/data-model-asc.html">https://docs.aws.amazon.com/aws-supply-chain/latest/userguide/data-model-asc.html</a>.</p>
        schema: <p>The custom schema of the data lake dataset and required for dataset in <b>default</b> and custom namespaces.</p>
        description: <p>The description of the dataset.</p>
        partition_spec: <p>The partition specification of the dataset. Partitioning can effectively improve the dataset query performance by reducing the amount of data scanned during query execution. But partitioning or not will affect how data get ingested by data ingestion methods, such as SendDataIntegrationEvent's dataset UPSERT will upsert records within partition (instead of within whole dataset). For more details, refer to those data ingestion documentations.</p>
        tags: <p>The tags of the dataset.</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:
        Create an AWS Supply Chain inbound order dataset

        >>> client.create_data_lake_dataset(instance_id='1877dd20-dee9-4639-8e99-cb67acf21fe5', namespace='asc', name='inbound_order', description='This is an AWS Supply Chain inbound order dataset', tags={'tagKey1': 'tagValue1', 'tagKey2': 'tagValue2'})
        Create a custom dataset

        >>> client.create_data_lake_dataset(instance_id='1877dd20-dee9-4639-8e99-cb67acf21fe5', namespace='default', name='my_dataset', description='This is a custom dataset', schema={'name': 'MyDataset', 'fields': [{'name': 'id', 'type': 'INT', 'isRequired': True}, {'name': 'description', 'type': 'STRING', 'isRequired': True}, {'name': 'price', 'type': 'DOUBLE', 'isRequired': False}, {'name': 'creation_time', 'type': 'TIMESTAMP', 'isRequired': False}, {'name': 'quantity', 'type': 'LONG', 'isRequired': False}], 'primaryKeys': [{'name': 'id'}]}, partition_spec={'fields': [{'name': 'creation_time', 'transform': {'type': 'DAY'}}, {'name': 'description', 'transform': {'type': 'IDENTITY'}}]}, tags={'tagKey1': 'tagValue1', 'tagKey2': 'tagValue2'})
    """

    def _handler(
        req: "OperationRequest[capo_supplychain.types.create_data_lake_dataset_request.CreateDataLakeDatasetRequest]",
    ) -> OperationResponse[
        "capo_supplychain.types.create_data_lake_dataset_response.CreateDataLakeDatasetResponse"
    ]:
        import capo_supplychain._operations.galaxy_public_api_gateway.create_data_lake_dataset

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDataLakeDataset")
    )
    input_: capo_supplychain.types.create_data_lake_dataset_request.CreateDataLakeDatasetRequest = {
        "instance_id": instance_id,
        "namespace": namespace,
        "name": name,
    }
    if schema is not None:
        input_["schema"] = schema
    if description is not None:
        input_["description"] = description
    if partition_spec is not None:
        input_["partition_spec"] = partition_spec
    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