rstudio / pins-r

Pin, Discover and Share Resources
https://pins.rstudio.com
Other
301 stars 62 forks source link

dev vs prod pins? #827

Open rjake opened 2 months ago

rjake commented 2 months ago

Would it be possible to have a simplified pin versioning that is similar to a gh branch? I'd like to work on the underlying data for the dev version of an app without affecting the prod version of an app. I'd like to be able to set a variable in both scripts to look for the right version. The recommendation would likely be to have a dev and prod server but we only have one.

Pin script:

env <- "prod"

pin_write(board, df_1, "pin-1", variant = env)
pin_write(board, df_2, "pin-2", variant = env)
pin_write(board, df_3, "pin-3", variant = env)
pin_write(board, df_4, "pin-4", variant = env)

App script

env <- "prod"

df_1 <- pin_read(board, "pin-1", variant = env)
df_2 <- pin_read(board, "pin-2", variant = env)
df_3 <- pin_read(board, "pin-3", variant = env)
df_4 <- pin_read(board, "pin-4", variant = env)
juliasilge commented 2 months ago

This is an interesting idea @rjake! We can keep this open to collect feedback from folks.

As a workaround for now, if you wanted to have dev vs. prod datasets, I would recommend storing them in separate pins with pin names like "pin-1-dev", and "pin-1-prod", like so:

env <- "prod"
df_1 <- pin_read(board, paste0("pin-1-", env))
racheleast commented 1 week ago

My team is looking for a similar feature, we would use the R_CONFIG_ACTIVE to set the env <- variable