:doc:`Keyspaces <../../keyspaces>` / Client / create_type

***********
create_type
***********



.. py:method:: Keyspaces.Client.create_type(**kwargs)

  

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

   

  To configure the required permissions, see `Permissions to create a UDT <https://docs.aws.amazon.com/keyspaces/latest/devguide/configure-udt-permissions.html#udt-permissions-create>`__ in the *Amazon Keyspaces Developer Guide*.

   

  For more information, see `User-defined types (UDTs) <https://docs.aws.amazon.com/keyspaces/latest/devguide/udts.html>`__ in the *Amazon Keyspaces Developer Guide*.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/keyspaces-2022-02-10/CreateType>`_  


  **Request Syntax**
  ::

    response = 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 <https://docs.aws.amazon.com/keyspaces/latest/devguide/cassandra-apis.html#cassandra-data-type>`__ 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``.

        
  
  **Exceptions**
  
  *   :py:class:`Keyspaces.Client.exceptions.ValidationException`

  
  *   :py:class:`Keyspaces.Client.exceptions.ServiceQuotaExceededException`

  
  *   :py:class:`Keyspaces.Client.exceptions.InternalServerException`

  
  *   :py:class:`Keyspaces.Client.exceptions.ConflictException`

  
  *   :py:class:`Keyspaces.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`Keyspaces.Client.exceptions.ResourceNotFoundException`

  