Skip to content

create_graph_using_import_task

create_graph_using_import_task(
    graph_name: GraphName,
    source: str,
    role_arn: RoleArn,
    *,
    config_overrides: Optional[NeptuneGraphClientConfig] = None,
    tags: Optional[TagMap] = None,
    public_connectivity: Optional[bool] = None,
    kms_key_identifier: Optional[KmsKeyArn] = None,
    vector_search_configuration: Optional[VectorSearchConfiguration] = None,
    replica_count: Optional[ReplicaCount] = None,
    deletion_protection: Optional[bool] = None,
    import_options: Optional[ImportOptions] = None,
    max_provisioned_memory: Optional[ProvisionedMemory] = None,
    min_provisioned_memory: Optional[ProvisionedMemory] = None,
    fail_on_error: Optional[bool] = None,
    format: Optional[Format] = None,
    parquet_type: Optional[ParquetType] = None,
    blank_node_handling: Optional[BlankNodeHandling] = None,
) -> CreateGraphUsingImportTaskOutput

Creates a new Neptune Analytics graph and imports data into it, either from Amazon Simple Storage Service (S3) or from a Neptune database or a Neptune database snapshot.

The data can be loaded from files in S3 that in either the Gremlin CSV format or the openCypher load format.

Parameters:

  • graph_name (GraphName) –

    A name for the new Neptune Analytics graph to be created.

    The name must contain from 1 to 63 letters, numbers, or hyphens, and its first character must be a letter. It cannot end with a hyphen or contain two consecutive hyphens. Only lowercase letters are allowed.

  • tags (Optional[TagMap], default: None ) –

    Adds metadata tags to the new graph. These tags can also be used with cost allocation reporting, or used in a Condition statement in an IAM policy.

  • public_connectivity (Optional[bool], default: None ) –

    Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated. (true to enable, or false to disable).

  • kms_key_identifier (Optional[KmsKeyArn], default: None ) –

    Specifies a KMS key to use to encrypt data imported into the new graph.

  • vector_search_configuration (Optional[VectorSearchConfiguration], default: None ) –

    Specifies the number of dimensions for vector embeddings that will be loaded into the graph. The value is specified as dimension=value. Max = 65,535

  • replica_count (Optional[ReplicaCount], default: None ) –

    The number of replicas in other AZs to provision on the new graph after import. Default = 1, Min = 0, Max = 2.

    Additional charges equivalent to the m-NCUs selected for the graph apply for each replica.

  • deletion_protection (Optional[bool], default: None ) –

    Indicates whether or not to enable deletion protection on the graph. The graph can’t be deleted when deletion protection is enabled. (true or false).

  • import_options (Optional[ImportOptions], default: None ) –

    Contains options for controlling the import process. For example, if the failOnError key is set to false, the import skips problem data and attempts to continue (whereas if set to true, the default, or if omitted, the import operation halts immediately when an error is encountered.

  • max_provisioned_memory (Optional[ProvisionedMemory], default: None ) –

    The maximum provisioned memory-optimized Neptune Capacity Units (m-NCUs) to use for the graph. Default: 1024, or the approved upper limit for your account.

    If both the minimum and maximum values are specified, the final provisioned-memory will be chosen per the actual size of your imported data. If neither value is specified, 128 m-NCUs are used.

  • min_provisioned_memory (Optional[ProvisionedMemory], default: None ) –

    The minimum provisioned memory-optimized Neptune Capacity Units (m-NCUs) to use for the graph. Default: 16

  • fail_on_error (Optional[bool], default: None ) –

    If set to true, the task halts when an import error is encountered. If set to false, the task skips the data that caused the error and continues if possible.

  • source (str) –

    A URL identifying to the location of the data to be imported. This can be an Amazon S3 path, or can point to a Neptune database endpoint or snapshot.

  • format (Optional[Format], default: None ) –

    Specifies the format of S3 data to be imported. Valid values are CSV, which identifies the Gremlin CSV format, OPEN_CYPHER, which identifies the openCypher load format, or ntriples, which identifies the RDF n-triples format.

  • parquet_type (Optional[ParquetType], default: None ) –

    The parquet type of the import task.

  • blank_node_handling (Optional[BlankNodeHandling], default: None ) –

    The method to handle blank nodes in the dataset. Currently, only convertToIri is supported, meaning blank nodes are converted to unique IRIs at load time. Must be provided when format is ntriples. For more information, see Handling RDF values.

  • role_arn (RoleArn) –

    The ARN of the IAM role that will allow access to the data that is to be imported.

Raises:

Source code in docs_src/capo_neptune_graph/_services/neptune_graph.py
def create_graph_using_import_task(
    self,
    graph_name: "capo_neptune_graph.types.graph_name.GraphName",
    source: str,
    role_arn: "capo_neptune_graph.types.role_arn.RoleArn",
    *,
    config_overrides: Optional[NeptuneGraphClientConfig] = None,
    tags: Optional["capo_neptune_graph.types.tag_map.TagMap"] = None,
    public_connectivity: Optional[bool] = None,
    kms_key_identifier: Optional[
        "capo_neptune_graph.types.kms_key_arn.KmsKeyArn"
    ] = None,
    vector_search_configuration: Optional[
        "capo_neptune_graph.types.vector_search_configuration.VectorSearchConfiguration"
    ] = None,
    replica_count: Optional[
        "capo_neptune_graph.types.replica_count.ReplicaCount"
    ] = None,
    deletion_protection: Optional[bool] = None,
    import_options: Optional[
        "capo_neptune_graph.types.import_options.ImportOptions"
    ] = None,
    max_provisioned_memory: Optional[
        "capo_neptune_graph.types.provisioned_memory.ProvisionedMemory"
    ] = None,
    min_provisioned_memory: Optional[
        "capo_neptune_graph.types.provisioned_memory.ProvisionedMemory"
    ] = None,
    fail_on_error: Optional[bool] = None,
    format: Optional["capo_neptune_graph.types.format.Format"] = None,
    parquet_type: Optional[
        "capo_neptune_graph.types.parquet_type.ParquetType"
    ] = None,
    blank_node_handling: Optional[
        "capo_neptune_graph.types.blank_node_handling.BlankNodeHandling"
    ] = None,
) -> "capo_neptune_graph.types.create_graph_using_import_task_output.CreateGraphUsingImportTaskOutput":
    """<p>Creates a new Neptune Analytics graph and imports data into it, either from Amazon Simple Storage Service (S3) or from a Neptune database or a Neptune database snapshot.</p> <p>The data can be loaded from files in S3 that in either the <a href="https://docs.aws.amazon.com/neptune/latest/userguide/bulk-load-tutorial-format-gremlin.html">Gremlin CSV format</a> or the <a href="https://docs.aws.amazon.com/neptune/latest/userguide/bulk-load-tutorial-format-opencypher.html">openCypher load format</a>.</p>

    Args:
        graph_name: <p>A name for the new Neptune Analytics graph to be created.</p> <p>The name must contain from 1 to 63 letters, numbers, or hyphens, and its first character must be a letter. It cannot end with a hyphen or contain two consecutive hyphens. Only lowercase letters are allowed.</p>
        tags: <p>Adds metadata tags to the new graph. These tags can also be used with cost allocation reporting, or used in a Condition statement in an IAM policy.</p>
        public_connectivity: <p>Specifies whether or not the graph can be reachable over the internet. All access to graphs is IAM authenticated. (<code>true</code> to enable, or <code>false</code> to disable).</p>
        kms_key_identifier: <p>Specifies a KMS key to use to encrypt data imported into the new graph.</p>
        vector_search_configuration: <p>Specifies the number of dimensions for vector embeddings that will be loaded into the graph. The value is specified as <code>dimension=</code>value. Max = 65,535 </p>
        replica_count: <p>The number of replicas in other AZs to provision on the new graph after import. Default = 1, Min = 0, Max = 2.</p> <important> <p> Additional charges equivalent to the m-NCUs selected for the graph apply for each replica. </p> </important>
        deletion_protection: <p>Indicates whether or not to enable deletion protection on the graph. The graph can’t be deleted when deletion protection is enabled. (<code>true</code> or <code>false</code>).</p>
        import_options: <p>Contains options for controlling the import process. For example, if the <code>failOnError</code> key is set to <code>false</code>, the import skips problem data and attempts to continue (whereas if set to <code>true</code>, the default, or if omitted, the import operation halts immediately when an error is encountered.</p>
        max_provisioned_memory: <p>The maximum provisioned memory-optimized Neptune Capacity Units (m-NCUs) to use for the graph. Default: 1024, or the approved upper limit for your account.</p> <p> If both the minimum and maximum values are specified, the final <code>provisioned-memory</code> will be chosen per the actual size of your imported data. If neither value is specified, 128 m-NCUs are used.</p>
        min_provisioned_memory: <p>The minimum provisioned memory-optimized Neptune Capacity Units (m-NCUs) to use for the graph. Default: 16</p>
        fail_on_error: <p>If set to <code>true</code>, the task halts when an import error is encountered. If set to <code>false</code>, the task skips the data that caused the error and continues if possible.</p>
        source: <p>A URL identifying to the location of the data to be imported. This can be an Amazon S3 path, or can point to a Neptune database endpoint or snapshot.</p>
        format: <p>Specifies the format of S3 data to be imported. Valid values are <code>CSV</code>, which identifies the <a href="https://docs.aws.amazon.com/neptune/latest/userguide/bulk-load-tutorial-format-gremlin.html">Gremlin CSV format</a>, <code>OPEN_CYPHER</code>, which identifies the <a href="https://docs.aws.amazon.com/neptune/latest/userguide/bulk-load-tutorial-format-opencypher.html">openCypher load format</a>, or <code>ntriples</code>, which identifies the <a href="https://docs.aws.amazon.com/neptune-analytics/latest/userguide/using-rdf-data.html">RDF n-triples</a> format.</p>
        parquet_type: <p>The parquet type of the import task.</p>
        blank_node_handling: <p>The method to handle blank nodes in the dataset. Currently, only <code>convertToIri</code> is supported, meaning blank nodes are converted to unique IRIs at load time. Must be provided when format is <code>ntriples</code>. For more information, see <a href="https://docs.aws.amazon.com/neptune-analytics/latest/userguide/using-rdf-data.html#rdf-handling">Handling RDF values</a>.</p>
        role_arn: <p>The ARN of the IAM role that will allow access to the data that is to be imported.</p>

    Raises:
        capo_neptune_graph.errors.conflict_exception.ConflictException: <p>Raised when a conflict is encountered.</p>
        capo_neptune_graph.errors.internal_server_exception.InternalServerException: <p>A failure occurred on the server.</p>
        capo_neptune_graph.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>A service quota was exceeded.</p>
        capo_neptune_graph.errors.throttling_exception.ThrottlingException: <p>The exception was interrupted by throttling.</p>
        capo_neptune_graph.errors.validation_exception.ValidationException: <p>A resource could not be validated.</p>
        capo_neptune_graph.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_neptune_graph.types.create_graph_using_import_task_input.CreateGraphUsingImportTaskInput]",
    ) -> OperationResponse[
        "capo_neptune_graph.types.create_graph_using_import_task_output.CreateGraphUsingImportTaskOutput"
    ]:
        import capo_neptune_graph._operations.amazon_neptune_graph.create_graph_using_import_task

        output, http_response = (
            capo_neptune_graph._operations.amazon_neptune_graph.create_graph_using_import_task.create_graph_using_import_task(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateGraphUsingImportTask")
    )
    input_: capo_neptune_graph.types.create_graph_using_import_task_input.CreateGraphUsingImportTaskInput = {
        "graph_name": graph_name,
        "source": source,
        "role_arn": role_arn,
    }
    if tags is not None:
        input_["tags"] = tags
    if public_connectivity is not None:
        input_["public_connectivity"] = public_connectivity
    if kms_key_identifier is not None:
        input_["kms_key_identifier"] = kms_key_identifier
    if vector_search_configuration is not None:
        input_["vector_search_configuration"] = vector_search_configuration
    if replica_count is not None:
        input_["replica_count"] = replica_count
    if deletion_protection is not None:
        input_["deletion_protection"] = deletion_protection
    if import_options is not None:
        input_["import_options"] = import_options
    if max_provisioned_memory is not None:
        input_["max_provisioned_memory"] = max_provisioned_memory
    if min_provisioned_memory is not None:
        input_["min_provisioned_memory"] = min_provisioned_memory
    if fail_on_error is not None:
        input_["fail_on_error"] = fail_on_error
    if format is not None:
        input_["format"] = format
    if parquet_type is not None:
        input_["parquet_type"] = parquet_type
    if blank_node_handling is not None:
        input_["blank_node_handling"] = blank_node_handling

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