:doc:`TimestreamWrite <../../timestream-write>` / Client / update_database

***************
update_database
***************



.. py:method:: TimestreamWrite.Client.update_database(**kwargs)

  

  Modifies the KMS key for an existing database. While updating the database, you must specify the database name and the identifier of the new KMS key to be used ( ``KmsKeyId``). If there are any concurrent ``UpdateDatabase`` requests, first writer wins.

   

  See `code sample <https://docs.aws.amazon.com/timestream/latest/developerguide/code-samples.update-db.html>`__ for details.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/timestream-write-2018-11-01/UpdateDatabase>`_  


  **Request Syntax**
  ::

    response = client.update_database(
        DatabaseName='string',
        KmsKeyId='string'
    )
    
  :type DatabaseName: string
  :param DatabaseName: **[REQUIRED]** 

    The name of the database.

    

  
  :type KmsKeyId: string
  :param KmsKeyId: **[REQUIRED]** 

    The identifier of the new KMS key ( ``KmsKeyId``) to be used to encrypt the data stored in the database. If the ``KmsKeyId`` currently registered with the database is the same as the ``KmsKeyId`` in the request, there will not be any update.

     

    You can specify the ``KmsKeyId`` using any of the following:

     

    
    * Key ID: ``1234abcd-12ab-34cd-56ef-1234567890ab``
     
    * Key ARN: ``arn:aws:kms:us-east-1:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab``
     
    * Alias name: ``alias/ExampleAlias``
     
    * Alias ARN: ``arn:aws:kms:us-east-1:111122223333:alias/ExampleAlias``
    

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'Database': {
              'Arn': 'string',
              'DatabaseName': 'string',
              'TableCount': 123,
              'KmsKeyId': 'string',
              'CreationTime': datetime(2015, 1, 1),
              'LastUpdatedTime': datetime(2015, 1, 1)
          }
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Database** *(dict) --* 

        A top-level container for a table. Databases and tables are the fundamental management concepts in Amazon Timestream. All tables in a database are encrypted with the same KMS key.

        
        

        - **Arn** *(string) --* 

          The Amazon Resource Name that uniquely identifies this database.

          
        

        - **DatabaseName** *(string) --* 

          The name of the Timestream database.

          
        

        - **TableCount** *(integer) --* 

          The total number of tables found within a Timestream database.

          
        

        - **KmsKeyId** *(string) --* 

          The identifier of the KMS key used to encrypt the data stored in the database.

          
        

        - **CreationTime** *(datetime) --* 

          The time when the database was created, calculated from the Unix epoch time.

          
        

        - **LastUpdatedTime** *(datetime) --* 

          The last time that this database was updated.

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

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

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

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

  
  *   :py:class:`TimestreamWrite.Client.exceptions.ThrottlingException`

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

  
  *   :py:class:`TimestreamWrite.Client.exceptions.InvalidEndpointException`

  