Skip to content

import_notebook async

import_notebook(
    work_group: WorkGroupName,
    name: NotebookName,
    type: NotebookType,
    *,
    config_overrides: Optional[AsyncAthenaClientConfig] = None,
    payload: Optional[Payload] = None,
    notebook_s3_location_uri: Optional[S3Uri] = None,
    client_request_token: Optional[ClientRequestToken] = None,
) -> ImportNotebookOutput

Imports a single ipynb file to a Spark enabled workgroup. To import the notebook, the request must specify a value for either Payload or NoteBookS3LocationUri. If neither is specified or both are specified, an InvalidRequestException occurs. The maximum file size that can be imported is 10 megabytes. If an ipynb file with the same name already exists in the workgroup, throws an error.

Parameters:

  • work_group (WorkGroupName) –

    The name of the Spark enabled workgroup to import the notebook to.

  • name (NotebookName) –

    The name of the notebook to import.

  • payload (Optional[Payload], default: None ) –

    The notebook content to be imported. The payload must be in ipynb format.

  • type (NotebookType) –

    The notebook content type. Currently, the only valid type is IPYNB.

  • notebook_s3_location_uri (Optional[S3Uri], default: None ) –

    A URI that specifies the Amazon S3 location of a notebook file in ipynb format.

  • client_request_token (Optional[ClientRequestToken], default: None ) –

    A unique case-sensitive string used to ensure the request to import the notebook is idempotent (executes only once).

    This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for you. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.

Raises:

Source code in docs_src/capo_athena/_services/async_athena.py
async def import_notebook(
    self,
    work_group: "capo_athena.types.work_group_name.WorkGroupName",
    name: "capo_athena.types.notebook_name.NotebookName",
    type: "capo_athena.types.notebook_type.NotebookType",
    *,
    config_overrides: Optional[AsyncAthenaClientConfig] = None,
    payload: Optional["capo_athena.types.payload.Payload"] = None,
    notebook_s3_location_uri: Optional["capo_athena.types.s3_uri.S3Uri"] = None,
    client_request_token: Optional[
        "capo_athena.types.client_request_token.ClientRequestToken"
    ] = None,
) -> "capo_athena.types.import_notebook_output.ImportNotebookOutput":
    """<p>Imports a single <code>ipynb</code> file to a Spark enabled workgroup. To import the notebook, the request must specify a value for either <code>Payload</code> or <code>NoteBookS3LocationUri</code>. If neither is specified or both are specified, an <code>InvalidRequestException</code> occurs. The maximum file size that can be imported is 10 megabytes. If an <code>ipynb</code> file with the same name already exists in the workgroup, throws an error.</p>

    Args:
        work_group: <p>The name of the Spark enabled workgroup to import the notebook to.</p>
        name: <p>The name of the notebook to import.</p>
        payload: <p>The notebook content to be imported. The payload must be in <code>ipynb</code> format.</p>
        type: <p>The notebook content type. Currently, the only valid type is <code>IPYNB</code>.</p>
        notebook_s3_location_uri: <p>A URI that specifies the Amazon S3 location of a notebook file in <code>ipynb</code> format.</p>
        client_request_token: <p>A unique case-sensitive string used to ensure the request to import the notebook is idempotent (executes only once).</p> <important> <p>This token is listed as not required because Amazon Web Services SDKs (for example the Amazon Web Services SDK for Java) auto-generate the token for you. If you are not using the Amazon Web Services SDK or the Amazon Web Services CLI, you must provide this token or the action will fail.</p> </important>

    Raises:
        capo_athena.errors.internal_server_exception.InternalServerException: <p>Indicates a platform issue, which may be due to a transient condition or outage.</p>
        capo_athena.errors.invalid_request_exception.InvalidRequestException: <p>Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.</p>
        capo_athena.errors.too_many_requests_exception.TooManyRequestsException: <p>Indicates that the request was throttled.</p>
        capo_athena.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_athena.types.import_notebook_input.ImportNotebookInput]",
    ) -> AsyncOperationResponse[
        "capo_athena.types.import_notebook_output.ImportNotebookOutput"
    ]:
        import capo_athena._operations.amazon_athena.import_notebook

        (
            output,
            http_response,
        ) = await capo_athena._operations.amazon_athena.import_notebook.async_import_notebook(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ImportNotebook")
    )
    input_: capo_athena.types.import_notebook_input.ImportNotebookInput = {
        "work_group": work_group,
        "name": name,
        "type": type,
    }
    if payload is not None:
        input_["payload"] = payload
    if notebook_s3_location_uri is not None:
        input_["notebook_s3_location_uri"] = notebook_s3_location_uri
    if client_request_token is not None:
        input_["client_request_token"] = client_request_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output