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 |
container |
The name of the container. |
database |
For |
partition_key |
For |
partition_version |
For |
autoscale_maxRUs , manual_RUs |
For |
headers , ... |
Optional arguments passed to lower-level functions. |
confirm |
For |
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)