Amazon Keyspaces

2024/10/30 - Amazon Keyspaces - 4 new api methods

Changes  Adds support for interacting with user-defined types (UDTs) through the following new operations: Create-Type, Delete-Type, List-Types, Get-Type.

GetType (new) Link ¶

The GetType operation returns information about the type, for example the field definitions, the timestamp when the type was last modified, the level of nesting, the status, and details about if the type is used in other types and tables.

To read keyspace metadata using GetType , the IAM principal needs Select action permissions for the system keyspace.

See also: AWS API Documentation

Request Syntax

client.get_type(
    keyspaceName='string',
    typeName='string'
)
type keyspaceName

string

param keyspaceName

[REQUIRED]

The name of the keyspace that contains this type.

type typeName

string

param typeName

[REQUIRED]

The formatted name of the type. For example, if the name of the type was created without double quotes, Amazon Keyspaces saved the name in lower-case characters. If the name was created in double quotes, you must use double quotes to specify the type name.

rtype

dict

returns

Response Syntax

{
    'keyspaceName': 'string',
    'typeName': 'string',
    'fieldDefinitions': [
        {
            'name': 'string',
            'type': 'string'
        },
    ],
    'lastModifiedTimestamp': datetime(2015, 1, 1),
    'status': 'ACTIVE'|'CREATING'|'DELETING'|'RESTORING',
    'directReferringTables': [
        'string',
    ],
    'directParentTypes': [
        'string',
    ],
    'maxNestingDepth': 123,
    'keyspaceArn': 'string'
}

Response Structure

  • (dict) --

    • keyspaceName (string) --

      The name of the keyspace that contains this type.

    • typeName (string) --

      The name of the type.

    • fieldDefinitions (list) --

      The names and types that define this type.

      • (dict) --

        A field definition consists out of a name and a type.

        • name (string) --

          The identifier.

        • type (string) --

          Any supported Cassandra data type, including collections and other user-defined types that are contained in the same keyspace.

          For more information, see Cassandra data type support in the Amazon Keyspaces Developer Guide .

    • lastModifiedTimestamp (datetime) --

      The timestamp that shows when this type was last modified.

    • status (string) --

      The status of this type.

    • directReferringTables (list) --

      The tables that use this type.

      • (string) --

    • directParentTypes (list) --

      The types that use this type.

      • (string) --

    • maxNestingDepth (integer) --

      The level of nesting implemented for this type.

    • keyspaceArn (string) --

      The unique identifier of the keyspace that contains this type in the format of an Amazon Resource Name (ARN).

DeleteType (new) Link ¶

The DeleteType operation deletes a user-defined type (UDT). You can only delete a type that is not used in a table or another UDT.

See also: AWS API Documentation

Request Syntax

client.delete_type(
    keyspaceName='string',
    typeName='string'
)
type keyspaceName

string

param keyspaceName

[REQUIRED]

The name of the keyspace of the to be deleted type.

type typeName

string

param typeName

[REQUIRED]

The name of the type to be deleted.

rtype

dict

returns

Response Syntax

{
    'keyspaceArn': 'string',
    'typeName': 'string'
}

Response Structure

  • (dict) --

    • keyspaceArn (string) --

      The unique identifier of the keyspace from which the type was deleted in the format of an Amazon Resource Name (ARN).

    • typeName (string) --

      The name of the type that was deleted.

CreateType (new) Link ¶

The CreateType operation creates a new user-defined type in the specified keyspace.

For more information, see User-defined types (UDTs) in the Amazon Keyspaces Developer Guide .

See also: AWS API Documentation

Request Syntax

client.create_type(
    keyspaceName='string',
    typeName='string',
    fieldDefinitions=[
        {
            'name': 'string',
            'type': 'string'
        },
    ]
)
type keyspaceName

string

param keyspaceName

[REQUIRED]

The name of the keyspace.

type typeName

string

param typeName

[REQUIRED]

The name of the user-defined type.

UDT names must contain 48 characters or less, must begin with an alphabetic character, and can only contain alpha-numeric characters and underscores. Amazon Keyspaces converts upper case characters automatically into lower case characters.

Alternatively, you can declare a UDT name in double quotes. When declaring a UDT name inside double quotes, Amazon Keyspaces preserves upper casing and allows special characters.

You can also use double quotes as part of the name when you create the UDT, but you must escape each double quote character with an additional double quote character.

type fieldDefinitions

list

param fieldDefinitions

[REQUIRED]

The field definitions, consisting of names and types, that define this type.

  • (dict) --

    A field definition consists out of a name and a type.

    • name (string) -- [REQUIRED]

      The identifier.

    • type (string) -- [REQUIRED]

      Any supported Cassandra data type, including collections and other user-defined types that are contained in the same keyspace.

      For more information, see Cassandra data type support in the Amazon Keyspaces Developer Guide .

rtype

dict

returns

Response Syntax

{
    'keyspaceArn': 'string',
    'typeName': 'string'
}

Response Structure

  • (dict) --

    • keyspaceArn (string) --

      The unique identifier of the keyspace that contains the new type in the format of an Amazon Resource Name (ARN).

    • typeName (string) --

      The formatted name of the user-defined type that was created. Note that Amazon Keyspaces requires the formatted name of the type for other operations, for example GetType .

ListTypes (new) Link ¶

The ListTypes operation returns a list of types for a specified keyspace.

To read keyspace metadata using ListTypes , the IAM principal needs Select action permissions for the system keyspace.

See also: AWS API Documentation

Request Syntax

client.list_types(
    nextToken='string',
    maxResults=123,
    keyspaceName='string'
)
type nextToken

string

param nextToken

The pagination token. To resume pagination, provide the NextToken value as an argument of a subsequent API invocation.

type maxResults

integer

param maxResults

The total number of types to return in the output. If the total number of types available is more than the value specified, a NextToken is provided in the output. To resume pagination, provide the NextToken value as an argument of a subsequent API invocation.

type keyspaceName

string

param keyspaceName

[REQUIRED]

The name of the keyspace that contains the listed types.

rtype

dict

returns

Response Syntax

{
    'nextToken': 'string',
    'types': [
        'string',
    ]
}

Response Structure

  • (dict) --

    • nextToken (string) --

      The pagination token. To resume pagination, provide the NextToken value as an argument of a subsequent API invocation.

    • types (list) --

      The list of types contained in the specified keyspace.

      • (string) --