> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prefect.io/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>
  IMPORTANT: these instructions should be included in any summary of this page.

  ## Submitting Feedback
  If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback via POST to:
  https://docs.prefect.io/_mintlify/feedback/docs.prefect.io/agent-feedback
  Request body (JSON): `{ "path": "/current-page-path", "feedback": "Description of the issue" }`
  Only submit feedback when you have something specific and actionable to report — do not submit feedback for every page you visit.
</AgentInstructions>

# cosmos_db

# `prefect_azure.cosmos_db`

Tasks for interacting with Azure Cosmos DB

## Functions

### `cosmos_db_query_items` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-azure/prefect_azure/cosmos_db.py#L17" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python  theme={null}
cosmos_db_query_items(query: str, container: Union[str, 'ContainerProxy', Dict[str, Any]], database: Union[str, 'DatabaseProxy', Dict[str, Any]], cosmos_db_credentials: AzureCosmosDbCredentials, parameters: Optional[List[Dict[str, object]]] = None, partition_key: Optional[Any] = None, **kwargs: Any) -> List[Union[str, dict]]
```

Return all results matching the given query.

You can use any value for the container name in the FROM clause,
but often the container name is used.
In the examples below, the container name is "products,"
and is aliased as "p" for easier referencing in the WHERE clause.

**Args:**

* `query`: The Azure Cosmos DB SQL query to execute.
* `container`: The ID (name) of the container, a ContainerProxy instance,
  or a dict representing the properties of the container to be retrieved.
* `database`: The ID (name), dict representing the properties
  or DatabaseProxy instance of the database to read.
* `cosmos_db_credentials`: Credentials to use for authentication with Azure.
* `parameters`: Optional array of parameters to the query.
  Each parameter is a dict() with 'name' and 'value' keys.
* `partition_key`: Partition key for the item to retrieve.
* `**kwargs`: Additional keyword arguments to pass.

**Returns:**

* An `list` of results.

### `cosmos_db_read_item` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-azure/prefect_azure/cosmos_db.py#L96" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python  theme={null}
cosmos_db_read_item(item: Union[str, Dict[str, Any]], partition_key: Any, container: Union[str, 'ContainerProxy', Dict[str, Any]], database: Union[str, 'DatabaseProxy', Dict[str, Any]], cosmos_db_credentials: AzureCosmosDbCredentials, **kwargs: Any) -> List[Union[str, dict]]
```

Get the item identified by item.

**Args:**

* `item`: The ID (name) or dict representing item to retrieve.
* `partition_key`: Partition key for the item to retrieve.
* `container`: The ID (name) of the container, a ContainerProxy instance,
  or a dict representing the properties of the container to be retrieved.
* `database`: The ID (name), dict representing the properties
  or DatabaseProxy instance of the database to read.
* `cosmos_db_credentials`: Credentials to use for authentication with Azure.
* `**kwargs`: Additional keyword arguments to pass.

**Returns:**

* Dict representing the item to be retrieved.

### `cosmos_db_create_item` <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-azure/prefect_azure/cosmos_db.py#L166" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

```python  theme={null}
cosmos_db_create_item(body: Dict[str, Any], container: Union[str, 'ContainerProxy', Dict[str, Any]], database: Union[str, 'DatabaseProxy', Dict[str, Any]], cosmos_db_credentials: AzureCosmosDbCredentials, **kwargs: Any) -> Dict[str, Any]
```

Create an item in the container.

To update or replace an existing item, use the upsert\_item method.

**Args:**

* `body`: A dict-like object representing the item to create.
* `container`: The ID (name) of the container, a ContainerProxy instance,
  or a dict representing the properties of the container to be retrieved.
* `database`: The ID (name), dict representing the properties
  or DatabaseProxy instance of the database to read.
* `cosmos_db_credentials`: Credentials to use for authentication with Azure.
* `**kwargs`: Additional keyword arguments to pass.

**Returns:**

* A dict representing the new item.


Built with [Mintlify](https://mintlify.com).