dm_has_fk() checks if a foreign key reference exists between two tables in a dm.

dm_has_fk(dm, table, ref_table)

Arguments

dm

A dm object.

table

A table in the dm.

ref_table

The table to be checked if it is referred to.

Value

A boolean value: TRUE if a reference from table to ref_table exists, FALSE otherwise.

See also

Other foreign key functions: dm_add_fk(), dm_enum_fk_candidates(), dm_get_all_fks(), dm_get_fk()

Examples

dm_nycflights13() %>% dm_has_fk(flights, airports)
#> [1] TRUE
dm_nycflights13() %>% dm_has_fk(airports, flights)
#> [1] FALSE