Learn R Programming

dm (version 0.0.6.9000)

dm_get_pk: Retrieve the name of the primary key columns of a dm table

Description

dm_get_pk() returns the names of the columns marked as primary key of a table of a dm object. If no primary key is set for the table, an empty character vector is returned.

Usage

dm_get_pk(dm, table)

Arguments

dm

A dm object.

table

A table in the dm.

Value

A character vector with the column name(s) of the primary key of table.

Compound keys

Currently, keys consisting of more than one column are not supported. This feature is planned for dm 0.2.0. Therefore the function may return vectors of length greater than one in the future.

See Also

Other primary key functions: dm_add_pk(), dm_get_all_pks(), dm_has_pk(), enum_pk_candidates()

Examples

Run this code
# NOT RUN {
library(dplyr)
nycflights_dm <- dm_nycflights13()

nycflights_dm %>%
  dm_get_pk(planes)
# }

Run the code above in your browser using DataLab