Skip to content

create_kx_changeset

create_kx_changeset(
    environment_id: EnvironmentId,
    database_name: DatabaseName,
    change_requests: ChangeRequests,
    client_token: ClientTokenString,
    *,
    config_overrides: Optional[finspaceClientConfig] = None,
) -> CreateKxChangesetResponse

Creates a changeset for a kdb database. A changeset allows you to add and delete existing files by using an ordered list of change requests.

Parameters:

  • environment_id (EnvironmentId) –

    A unique identifier of the kdb environment.

  • database_name (DatabaseName) –

    The name of the kdb database.

  • change_requests (ChangeRequests) –

    A list of change request objects that are run in order. A change request object consists of changeType , s3Path, and dbPath. A changeType can have the following values:

    • PUT – Adds or updates files in a database.

    • DELETE – Deletes files in a database.

    All the change requests require a mandatory dbPath attribute that defines the path within the database directory. All database paths must start with a leading / and end with a trailing /. The s3Path attribute defines the s3 source file path and is required for a PUT change type. The s3path must end with a trailing / if it is a directory and must end without a trailing / if it is a file.

    Here are few examples of how you can use the change request object:

    1. This request adds a single sym file at database root location.

      { "changeType": "PUT", "s3Path":"s3://bucket/db/sym", "dbPath":"/"}

    2. This request adds files in the given s3Path under the 2020.01.02 partition of the database.

      { "changeType": "PUT", "s3Path":"s3://bucket/db/2020.01.02/", "dbPath":"/2020.01.02/"}

    3. This request adds files in the given s3Path under the taq table partition of the database.

      [ { "changeType": "PUT", "s3Path":"s3://bucket/db/2020.01.02/taq/", "dbPath":"/2020.01.02/taq/"}]

    4. This request deletes the 2020.01.02 partition of the database.

      [{ "changeType": "DELETE", "dbPath": "/2020.01.02/"} ]

    5. The DELETE request allows you to delete the existing files under the 2020.01.02 partition of the database, and the PUT request adds a new taq table under it.

      [ {"changeType": "DELETE", "dbPath":"/2020.01.02/"}, {"changeType": "PUT", "s3Path":"s3://bucket/db/2020.01.02/taq/", "dbPath":"/2020.01.02/taq/"}]

  • client_token (ClientTokenString) –

    A token that ensures idempotency. This token expires in 10 minutes.

Raises:

Source code in docs_src/capo_finspace/_services/finspace.py
def create_kx_changeset(
    self,
    environment_id: "capo_finspace.types.environment_id.EnvironmentId",
    database_name: "capo_finspace.types.database_name.DatabaseName",
    change_requests: "capo_finspace.types.change_requests.ChangeRequests",
    client_token: "capo_finspace.types.client_token_string.ClientTokenString",
    *,
    config_overrides: Optional[finspaceClientConfig] = None,
) -> "capo_finspace.types.create_kx_changeset_response.CreateKxChangesetResponse":
    """<p> Creates a changeset for a kdb database. A changeset allows you to add and delete existing files by using an ordered list of change requests. </p>

    Args:
        environment_id: <p>A unique identifier of the kdb environment.</p>
        database_name: <p>The name of the kdb database.</p>
        change_requests: <p>A list of change request objects that are run in order. A change request object consists of <code>changeType</code> , <code>s3Path</code>, and <code>dbPath</code>. A changeType can have the following values: </p> <ul> <li> <p>PUT – Adds or updates files in a database.</p> </li> <li> <p>DELETE – Deletes files in a database.</p> </li> </ul> <p>All the change requests require a mandatory <code>dbPath</code> attribute that defines the path within the database directory. All database paths must start with a leading / and end with a trailing /. The <code>s3Path</code> attribute defines the s3 source file path and is required for a PUT change type. The <code>s3path</code> must end with a trailing / if it is a directory and must end without a trailing / if it is a file. </p> <p>Here are few examples of how you can use the change request object:</p> <ol> <li> <p>This request adds a single sym file at database root location. </p> <p> <code>{ "changeType": "PUT", "s3Path":"s3://bucket/db/sym", "dbPath":"/"}</code> </p> </li> <li> <p>This request adds files in the given <code>s3Path</code> under the 2020.01.02 partition of the database.</p> <p> <code>{ "changeType": "PUT", "s3Path":"s3://bucket/db/2020.01.02/", "dbPath":"/2020.01.02/"}</code> </p> </li> <li> <p>This request adds files in the given <code>s3Path</code> under the <i>taq</i> table partition of the database.</p> <p> <code>[ { "changeType": "PUT", "s3Path":"s3://bucket/db/2020.01.02/taq/", "dbPath":"/2020.01.02/taq/"}]</code> </p> </li> <li> <p>This request deletes the 2020.01.02 partition of the database.</p> <p> <code>[{ "changeType": "DELETE", "dbPath": "/2020.01.02/"} ]</code> </p> </li> <li> <p>The <i>DELETE</i> request allows you to delete the existing files under the 2020.01.02 partition of the database, and the <i>PUT</i> request adds a new taq table under it.</p> <p> <code>[ {"changeType": "DELETE", "dbPath":"/2020.01.02/"}, {"changeType": "PUT", "s3Path":"s3://bucket/db/2020.01.02/taq/", "dbPath":"/2020.01.02/taq/"}]</code> </p> </li> </ol>
        client_token: <p>A token that ensures idempotency. This token expires in 10 minutes.</p>

    Raises:
        capo_finspace.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_finspace.errors.conflict_exception.ConflictException: <p>There was a conflict with this action, and it could not be completed.</p>
        capo_finspace.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_finspace.errors.limit_exceeded_exception.LimitExceededException: <p>A service limit or quota is exceeded.</p>
        capo_finspace.errors.resource_not_found_exception.ResourceNotFoundException: <p>One or more resources can't be found.</p>
        capo_finspace.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_finspace.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an AWS service.</p>
        capo_finspace.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_finspace.types.create_kx_changeset_request.CreateKxChangesetRequest]",
    ) -> OperationResponse[
        "capo_finspace.types.create_kx_changeset_response.CreateKxChangesetResponse"
    ]:
        import capo_finspace._operations.aws_habanero_management_service.create_kx_changeset

        output, http_response = (
            capo_finspace._operations.aws_habanero_management_service.create_kx_changeset.create_kx_changeset(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateKxChangeset")
    )
    input_: capo_finspace.types.create_kx_changeset_request.CreateKxChangesetRequest = {
        "environment_id": environment_id,
        "database_name": database_name,
        "change_requests": change_requests,
        "client_token": client_token,
    }

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