finspace / Client / create_kx_changeset

create_kx_changeset#

finspace.Client.create_kx_changeset(**kwargs)#

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.

See also: AWS API Documentation

Request Syntax

response = client.create_kx_changeset(
    environmentId='string',
    databaseName='string',
    changeRequests=[
        {
            'changeType': 'PUT'|'DELETE',
            's3Path': 'string',
            'dbPath': 'string'
        },
    ],
    clientToken='string'
)
Parameters:
  • environmentId (string) –

    [REQUIRED]

    A unique identifier of the kdb environment.

  • databaseName (string) –

    [REQUIRED]

    The name of the kdb database.

  • changeRequests (list) –

    [REQUIRED]

    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:

    • This request adds a single sym file at database root location. { "changeType": "PUT", "s3Path":"s3://bucket/db/sym", "dbPath":"/"}

    • 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/"}

    • 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/"}]

    • This request deletes the 2020.01.02 partition of the database. [{ "changeType": "DELETE", "dbPath": "/2020.01.02/"} ]

    • 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/"}]

    • (dict) –

      A list of change request objects.

      • changeType (string) – [REQUIRED]

        Defines the type of change request. A changeType can have the following values:

        • PUT – Adds or updates files in a database.

        • DELETE – Deletes files in a database.

      • s3Path (string) –

        Defines the S3 path of the source file that is required to add or update files in a database.

      • dbPath (string) – [REQUIRED]

        Defines the path within the database directory.

  • clientToken (string) –

    [REQUIRED]

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

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'changesetId': 'string',
    'databaseName': 'string',
    'environmentId': 'string',
    'changeRequests': [
        {
            'changeType': 'PUT'|'DELETE',
            's3Path': 'string',
            'dbPath': 'string'
        },
    ],
    'createdTimestamp': datetime(2015, 1, 1),
    'lastModifiedTimestamp': datetime(2015, 1, 1),
    'status': 'PENDING'|'PROCESSING'|'FAILED'|'COMPLETED',
    'errorInfo': {
        'errorMessage': 'string',
        'errorType': 'The inputs to this request are invalid.'|'Service limits have been exceeded.'|'Missing required permission to perform this request.'|'One or more inputs to this request were not found.'|'The system temporarily lacks sufficient resources to process the request.'|'An internal error has occurred.'|'Cancelled'|'A user recoverable error has occurred'
    }
}

Response Structure

  • (dict) –

    • changesetId (string) –

      A unique identifier for the changeset.

    • databaseName (string) –

      The name of the kdb database.

    • environmentId (string) –

      A unique identifier for the kdb environment.

    • changeRequests (list) –

      A list of change requests.

      • (dict) –

        A list of change request objects.

        • changeType (string) –

          Defines the type of change request. A changeType can have the following values:

          • PUT – Adds or updates files in a database.

          • DELETE – Deletes files in a database.

        • s3Path (string) –

          Defines the S3 path of the source file that is required to add or update files in a database.

        • dbPath (string) –

          Defines the path within the database directory.

    • createdTimestamp (datetime) –

      The timestamp at which the changeset was created in FinSpace. The value is determined as epoch time in milliseconds. For example, the value for Monday, November 1, 2021 12:00:00 PM UTC is specified as 1635768000000.

    • lastModifiedTimestamp (datetime) –

      The timestamp at which the changeset was updated in FinSpace. The value is determined as epoch time in milliseconds. For example, the value for Monday, November 1, 2021 12:00:00 PM UTC is specified as 1635768000000.

    • status (string) –

      Status of the changeset creation process.

      • Pending – Changeset creation is pending.

      • Processing – Changeset creation is running.

      • Failed – Changeset creation has failed.

      • Complete – Changeset creation has succeeded.

    • errorInfo (dict) –

      The details of the error that you receive when creating a changeset. It consists of the type of error and the error message.

      • errorMessage (string) –

        Specifies the error message that appears if a flow fails.

      • errorType (string) –

        Specifies the type of error.

Exceptions

  • finspace.Client.exceptions.InternalServerException

  • finspace.Client.exceptions.ValidationException

  • finspace.Client.exceptions.ThrottlingException

  • finspace.Client.exceptions.AccessDeniedException

  • finspace.Client.exceptions.ResourceNotFoundException

  • finspace.Client.exceptions.ConflictException

  • finspace.Client.exceptions.LimitExceededException