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.
dm_get_pk(dm, table)
dm | A |
---|---|
table | A table in the |
A list with character vectors with the column name(s) of the
primary keys of table
.
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.
Similarly, each table currently can have only one primary key.
This restriction may be lifted in the future.
For this reason, and for symmetry with dm_get_fk()
,
this function returns a slit of character vectors.
Other primary key functions:
dm_add_pk()
,
dm_get_all_pks()
,
dm_has_pk()
,
enum_pk_candidates()
#> <list_of<character>[0]>#> <list_of<character>[1]> #> [[1]] #> [1] "tailnum" #>