cynkra / dm

Working with relational data models in R
https://dm.cynkra.com
Other
497 stars 50 forks source link

dm_pixarfilms has unsatisfied constraints #707

Closed moodymudskipper closed 2 years ago

moodymudskipper commented 2 years ago
library(dm, warn.conflicts = FALSE)
dm_examine_constraints(dm_pixarfilms())
#> ! Unsatisfied constraints:
#> • Table `pixar_films`: primary key `film`: has 1 missing values
#> • Table `pixar_people`: primary key `film`     , `role_type`: has duplicate values: Toy Story 4, Storywriter (8), Cars, Screenwriter (6), The Good Dinosaur, Storywriter (5), Brave, Screenwriter (4), Cars 3, Storywriter (4), …

Created on 2021-12-09 by the reprex package (v2.0.1)

AFAII the missing film is for films TBA, in our case it's in 2023, so I don't believe it's a mistake. We could either :

film is the most important key of the dm so the dm has little value without it. Removing the row seems the easiest. A problem is we don't match {pixarfilms}'s data anymore.

The second issue is simply because one can have several persons with the same role on a movie, so we might have no pk or a pk on all 3 columns. The key doesn't have any child table so removing it seems the best solution to me.

Both issues happened because dm_add_pk() was used with check = FALSE(default), so I'll use check=TRUE in the fixed version.

github-actions[bot] commented 1 year ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.