airflow.providers.microsoft.azure.hooks.cosmos¶
This module contains integration with Azure CosmosDB.
AzureCosmosDBHook communicates via the Azure Cosmos library. Make sure that a Airflow connection of type azure_cosmos exists. Authorization can be done by supplying a login (=Endpoint uri), password (=secret key) and extra fields database_name and collection_name to specify the default database and collection to use (see connection azure_cosmos_default for an example).
Module Contents¶
Classes¶
| Interacts with Azure CosmosDB. | 
Functions¶
| 
 | Get Azure CosmosDB database link. | 
| 
 | Get Azure CosmosDB collection link. | 
| 
 | Get Azure CosmosDB document link. | 
- class airflow.providers.microsoft.azure.hooks.cosmos.AzureCosmosDBHook(azure_cosmos_conn_id=default_conn_name)[source]¶
- Bases: - airflow.hooks.base.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(collection_name, database_name)[source]¶
- Checks if a collection exists in CosmosDB. 
 - create_collection(collection_name, database_name=None, partition_key=None)[source]¶
- Creates a new collection in the CosmosDB database. 
 - delete_collection(collection_name, database_name=None)[source]¶
- Deletes an existing collection in the CosmosDB database. 
 - upsert_document(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(documents, database_name=None, collection_name=None)[source]¶
- Insert a list of new documents into an existing collection in the CosmosDB database. 
 - delete_document(document_id, database_name=None, collection_name=None, partition_key=None)[source]¶
- Delete an existing document out of a collection in the CosmosDB database. 
 - get_document(document_id, database_name=None, collection_name=None, partition_key=None)[source]¶
- Get a document from an existing collection in the CosmosDB database. 
 
- airflow.providers.microsoft.azure.hooks.cosmos.get_database_link(database_id)[source]¶
- Get Azure CosmosDB database link. 
