dm_get_all_uks()
checks the dm
object for unique keys
(primary keys, explicit and implicit unique keys) and returns the tables and
the respective unique key columns.
Value
A tibble with the following columns:
table
table name,
uk_col
column name(s) of primary key, as list of character vectors,
kind
kind of unique key, see details.
Details
There are 3 kinds of unique keys:
PK
: Primary key, set bydm_add_pk()
explicit UK
: Unique key, set bydm_add_uk()
implicit UK
: Unique key, not explicitly set, but referenced by a foreign key.
See also
Other primary key functions:
dm_add_pk()
,
dm_add_uk()
,
dm_get_all_pks()
,
dm_has_pk()
,
dm_rm_pk()
,
dm_rm_uk()
,
enum_pk_candidates()
Examples
dm_nycflights13() %>%
dm_get_all_uks()
#> # A tibble: 4 × 3
#> table uk_col kind
#> <chr> <keys> <chr>
#> 1 airlines carrier PK
#> 2 airports faa PK
#> 3 planes tailnum PK
#> 4 weather origin, time_hour PK