insert_table_entity {AzureTableStor} | R Documentation |
Operations on table entities (rows)
Description
Operations on table entities (rows)
Usage
insert_table_entity(table, entity)
update_table_entity(
table,
entity,
row_key = NULL,
partition_key = NULL,
etag = NULL
)
delete_table_entity(table, row_key, partition_key, etag = NULL)
list_table_entities(table, filter = NULL, select = NULL, as_data_frame = TRUE)
get_table_entity(table, row_key, partition_key, select = NULL)
import_table_entities(
table,
data,
row_key = NULL,
partition_key = NULL,
batch_status_handler = c("warn", "stop", "message", "pass"),
...
)
Arguments
table |
A table object, of class |
entity |
For |
row_key , partition_key |
For |
etag |
For |
filter , select |
For |
as_data_frame |
For |
data |
For |
batch_status_handler |
For |
... |
For |
Details
These functions operate on rows of a table, also known as entities. insert
, get
, update
and delete_table_entity
operate on an individual row. import_table_entities
bulk-inserts multiple rows of data into the table, using batch transactions. list_table_entities
queries the table and returns multiple rows, subsetted on the filter
and select
arguments.
Table storage imposes the following requirements for properties (columns) of an entity:
There must be properties named
RowKey
andPartitionKey
, which together form the entity's unique identifier. These properties must be of type character.The property
Timestamp
cannot be used (strictly speaking, it is reserved by the system).There can be at most 255 properties per entity, although different entities can have different properties.
Table properties must be atomic. In particular, they cannot be nested lists.
Note that table storage does not require that all entities in a table must have the same properties.
For insert_table_entity
, update_table_entity
and import_table_entities
, you can also specify JSON text representing the data to insert/update/import, instead of a list or data frame.
list_table_entities(as_data_frame=TRUE)
for a large table may be slow. If this is a problem, and you know that all entities in the table have the same schema, try setting as_data_frame=FALSE
and converting to a data frame manually.
Value
insert_table_entity
and update_table_entity
return the Etag of the inserted/updated entity, invisibly.
get_table_entity
returns a named list of properties for the given entity.
list_table_entities
returns a data frame if as_data_frame=TRUE
, and a list of entities (rows) otherwise.
import_table_entities
invisibly returns a named list, with one component for each value of the PartitionKey
column. Each component contains the results of the individual operations to insert each row into the table.
See Also
storage_table, do_batch_transaction
Understanding the table service data model
Examples
## Not run:
endp <- table_endpoint("https://mycosmosdb.table.cosmos.azure.com:443", key="mykey")
tab <- create_storage_table(endp, "mytable")
insert_table_entity(tab, list(
RowKey="row1",
PartitionKey="partition1",
firstname="Bill",
lastname="Gates"
))
get_table_entity(tab, "row1", "partition1")
# specifying the entity as JSON text instead of a list
update_table_entity(tab,
'{
"RowKey": "row1",
"PartitionKey": "partition1",
"firstname": "Bill",
"lastname": "Gates"
}')
# we can import to the same table as above: table storage doesn't enforce a schema
import_table_entities(tab, mtcars,
row_key=row.names(mtcars),
partition_key=as.character(mtcars$cyl))
list_table_entities(tab)
list_table_entities(tab, filter="firstname eq 'Satya'")
list_table_entities(tab, filter="RowKey eq 'Toyota Corolla'")
delete_table_entity(tab, "row1", "partition1")
## End(Not run)