Skip to content

create_notebook

create_notebook(
    work_group: WorkGroupName,
    name: NotebookName,
    *,
    config_overrides: Optional[AthenaClientConfig] = None,
    client_request_token: Optional[ClientRequestToken] = None,
) -> CreateNotebookOutput

Creates an empty ipynb file in the specified Apache Spark enabled workgroup. Throws an error if a file in the workgroup with the same name already exists.

Parameters:

  • work_group (WorkGroupName) –

    The name of the Spark enabled workgroup in which the notebook will be created.

  • name (NotebookName) –

    The name of the ipynb file to be created in the Spark workgroup, without the .ipynb extension.

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

    A unique case-sensitive string used to ensure the request to create 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/athena.py
def create_notebook(
    self,
    work_group: "capo_athena.types.work_group_name.WorkGroupName",
    name: "capo_athena.types.notebook_name.NotebookName",
    *,
    config_overrides: Optional[AthenaClientConfig] = None,
    client_request_token: Optional[
        "capo_athena.types.client_request_token.ClientRequestToken"
    ] = None,
) -> "capo_athena.types.create_notebook_output.CreateNotebookOutput":
    """<p>Creates an empty <code>ipynb</code> file in the specified Apache Spark enabled workgroup. Throws an error if a file in the workgroup with the same name already exists.</p>

    Args:
        work_group: <p>The name of the Spark enabled workgroup in which the notebook will be created.</p>
        name: <p>The name of the <code>ipynb</code> file to be created in the Spark workgroup, without the <code>.ipynb</code> extension.</p>
        client_request_token: <p>A unique case-sensitive string used to ensure the request to create 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.
    """

    def _handler(
        req: "OperationRequest[capo_athena.types.create_notebook_input.CreateNotebookInput]",
    ) -> OperationResponse[
        "capo_athena.types.create_notebook_output.CreateNotebookOutput"
    ]:
        import capo_athena._operations.amazon_athena.create_notebook

        output, http_response = (
            capo_athena._operations.amazon_athena.create_notebook.create_notebook(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateNotebook")
    )
    input_: capo_athena.types.create_notebook_input.CreateNotebookInput = {
        "work_group": work_group,
        "name": name,
    }
    if client_request_token is not None:
        input_["client_request_token"] = client_request_token

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