:mod:`airflow.contrib.hooks.azure_cosmos_hook`
==============================================

.. py:module:: airflow.contrib.hooks.azure_cosmos_hook


Module Contents
---------------

.. py:class:: AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_default')

   Bases: :class:`airflow.hooks.base_hook.BaseHook`

   Interacts with Azure CosmosDB.

   login should be the endpoint uri, password should be the master key
   optionally, you can use the following extras to default these values
   {"database_name": "<DATABASE_NAME>", "collection_name": "COLLECTION_NAME"}.

   :param azure_cosmos_conn_id: Reference to the Azure CosmosDB connection.
   :type azure_cosmos_conn_id: str

   
   .. method:: get_conn(self)

      Return a cosmos db client.



   
   .. method:: __get_database_name(self, database_name=None)



   
   .. method:: __get_collection_name(self, collection_name=None)



   
   .. method:: does_collection_exist(self, collection_name, database_name=None)

      Checks if a collection exists in CosmosDB.



   
   .. method:: create_collection(self, collection_name, database_name=None)

      Creates a new collection in the CosmosDB database.



   
   .. method:: does_database_exist(self, database_name)

      Checks if a database exists in CosmosDB.



   
   .. method:: create_database(self, database_name)

      Creates a new database in CosmosDB.



   
   .. method:: delete_database(self, database_name)

      Deletes an existing database in CosmosDB.



   
   .. method:: delete_collection(self, collection_name, database_name=None)

      Deletes an existing collection in the CosmosDB database.



   
   .. method:: upsert_document(self, document, database_name=None, collection_name=None, document_id=None)

      Inserts a new document (or updates an existing one) into an existing
      collection in the CosmosDB database.



   
   .. method:: insert_documents(self, documents, database_name=None, collection_name=None)

      Insert a list of new documents into an existing collection in the CosmosDB database.



   
   .. method:: delete_document(self, document_id, database_name=None, collection_name=None)

      Delete an existing document out of a collection in the CosmosDB database.



   
   .. method:: get_document(self, document_id, database_name=None, collection_name=None)

      Get a document from an existing collection in the CosmosDB database.



   
   .. method:: get_documents(self, sql_string, database_name=None, collection_name=None, partition_key=None)

      Get a list of documents from an existing collection in the CosmosDB database via SQL query.




.. function:: get_database_link(database_id)

.. function:: get_collection_link(database_id, collection_id)

.. function:: get_document_link(database_id, collection_id, document_id)