get_cosmos_container {AzureCosmosR}R Documentation

Methods for working with Azure Cosmos DB containers

Description

Methods for working with Azure Cosmos DB containers

Usage

get_cosmos_container(object, ...)

## S3 method for class 'cosmos_database'
get_cosmos_container(object, container, ...)

## S3 method for class 'cosmos_endpoint'
get_cosmos_container(object, database, container, ...)

create_cosmos_container(object, ...)

## S3 method for class 'cosmos_database'
create_cosmos_container(
  object,
  container,
  partition_key,
  partition_version = 2,
  autoscale_maxRUs = NULL,
  manual_RUs = NULL,
  headers = list(),
  ...
)

delete_cosmos_container(object, ...)

## S3 method for class 'cosmos_database'
delete_cosmos_container(object, container, confirm = TRUE, ...)

## S3 method for class 'cosmos_container'
delete_cosmos_container(object, ...)

list_cosmos_containers(object, ...)

## S3 method for class 'cosmos_database'
list_cosmos_containers(object, ...)

Arguments

object

A Cosmos DB database object, as obtained from get_cosmos_database or create_cosmos_database, or for delete_cosmos_container.cosmos_container, the container object.

container

The name of the container.

database

For get_cosmos_container.cosmos_endpoint, the name of the database that includes the container.

partition_key

For create_cosmos_container, the name of the partition key.

partition_version

For create_cosmos_container, the partition version. Can be either 1 or 2. Version 2 supports large partition key values (longer than 100 bytes) but requires API version 2018-12-31 or later. Use version 1 if the container needs to be accessible to older Cosmos DB SDKs.

autoscale_maxRUs, manual_RUs

For create_cosmos_container, optional parameters for the maximum request units (RUs) allowed. See the Cosmos DB documentation for more details.

headers, ...

Optional arguments passed to lower-level functions.

confirm

For delete_cosmos_container, whether to ask for confirmation before deleting.

Details

These are methods for working with Cosmos DB containers using the core (SQL) API. A container is analogous to a table in SQL, or a collection in MongoDB.

get_cosmos_container, create_cosmos_container, delete_cosmos_container and list_cosmos_containers provide basic container management functionality.

get_partition_key returns the name of the partition key column in the container, and list_partition_key_values returns all the distinct values for this column. These are useful when working with queries that have to be mapped across partitions.

Value

For get_cosmos_container and create_cosmos_container, an object of class cosmos_container. For list_cosmos_container', a list of such objects.

See Also

cosmos_container, query_documents, bulk_import, bulk_delete

Examples

## Not run: 

endp <- cosmos_endpoint("https://myaccount.documents.azure.com:443/", key="mykey")
db <- get_cosmos_database(endp, "mydatabase")

create_cosmos_container(db, "mycontainer", partition_key="sex")

list_cosmos_containers(db)

cont <- get_cosmos_container(db, "mycontainer")

delete_cosmos_container(cont)


## End(Not run)

[Package AzureCosmosR version 1.0.0 Index]