Skip to contents

If a table name is provided, dm_rm_pk() removes the primary key from this table and leaves the dm object otherwise unaltered. If no table is given, the dm is stripped of all primary keys at once. An error is thrown if no primary key matches the selection criteria. If the selection criteria are ambiguous, a message with unambiguous replacement code is shown. Foreign keys are never removed.

Usage

dm_rm_pk(dm, table = NULL, columns = NULL, ..., fail_fk = NULL)

Arguments

dm

A dm object.

table

A table in the dm. Pass NULL to remove all matching keys.

columns

Table columns, unquoted. To refer to a compound key, use c(col1, col2). Pass NULL (the default) to remove all matching keys.

...

These dots are for future extensions and must be empty.

fail_fk

[Deprecated]

Value

An updated dm without the indicated primary key(s).

See also

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

Examples

dm_nycflights13() %>%
  dm_rm_pk(airports) %>%
  dm_draw()
%0

airlinesairlinescarrierairportsairportsfaaflightsflightscarriertailnumoriginorigin, time_hourflights:carrier->airlines:carrierflights:origin->airports:faaplanesplanestailnumflights:tailnum->planes:tailnumweatherweatherorigin, time_hourflights:origin, time_hour->weather:origin, time_hour