Skip to content

update_named_query

update_named_query(
    named_query_id: NamedQueryId,
    name: NameString,
    query_string: QueryString,
    *,
    config_overrides: Optional[AthenaClientConfig] = None,
    description: Optional[NamedQueryDescriptionString] = None,
) -> UpdateNamedQueryOutput

Updates a NamedQuery object. The database or workgroup cannot be updated.

Parameters:

Raises:

  • InternalServerException –

    Indicates a platform issue, which may be due to a transient condition or outage.

  • InvalidRequestException –

    Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_athena/_services/athena.py
def update_named_query(
    self,
    named_query_id: "capo_athena.types.named_query_id.NamedQueryId",
    name: "capo_athena.types.name_string.NameString",
    query_string: "capo_athena.types.query_string.QueryString",
    *,
    config_overrides: Optional[AthenaClientConfig] = None,
    description: Optional[
        "capo_athena.types.named_query_description_string.NamedQueryDescriptionString"
    ] = None,
) -> "capo_athena.types.update_named_query_output.UpdateNamedQueryOutput":
    """<p>Updates a <a>NamedQuery</a> object. The database or workgroup cannot be updated.</p>

    Args:
        named_query_id: <p>The unique identifier (UUID) of the query.</p>
        name: <p>The name of the query.</p>
        description: <p>The query description.</p>
        query_string: <p>The contents of the query with all query statements.</p>

    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.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_athena.types.update_named_query_input.UpdateNamedQueryInput]",
    ) -> OperationResponse[
        "capo_athena.types.update_named_query_output.UpdateNamedQueryOutput"
    ]:
        import capo_athena._operations.amazon_athena.update_named_query

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateNamedQuery")
    )
    input_: capo_athena.types.update_named_query_input.UpdateNamedQueryInput = {
        "named_query_id": named_query_id,
        "name": name,
        "query_string": query_string,
    }
    if description is not None:
        input_["description"] = description

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