airflow.contrib.hooks.azure_cosmos_hook¶
Module Contents¶
- 
class airflow.contrib.hooks.azure_cosmos_hook.AzureCosmosDBHook(azure_cosmos_conn_id='azure_cosmos_default')[source]¶
- Bases: - 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”}. - Parameters
- azure_cosmos_conn_id (str) – Reference to the Azure CosmosDB connection. 
 - 
does_collection_exist(self, collection_name, database_name=None)[source]¶
- Checks if a collection exists in CosmosDB. 
 - 
create_collection(self, collection_name, database_name=None)[source]¶
- Creates a new collection in the CosmosDB database. 
 - 
delete_collection(self, collection_name, database_name=None)[source]¶
- Deletes an existing collection in the CosmosDB database. 
 - 
upsert_document(self, document, database_name=None, collection_name=None, document_id=None)[source]¶
- Inserts a new document (or updates an existing one) into an existing collection in the CosmosDB database. 
 - 
insert_documents(self, documents, database_name=None, collection_name=None)[source]¶
- Insert a list of new documents into an existing collection in the CosmosDB database. 
 - 
delete_document(self, document_id, database_name=None, collection_name=None)[source]¶
- Delete an existing document out of a collection in the CosmosDB database.