rstudio / pins-r

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

Use of `Tagging` argument in `pin_write` and `pin_upload` sets object tags (AWS S3), but `pin_meta` returns the `tags` entry as NULL #804

Closed michaelhogersnplm closed 7 months ago

michaelhogersnplm commented 7 months ago

Hi there,

Thank you for this package, it is very useful and I noticed something that could possibly be a bug in the pins/paws interaction.

Following the example from https://pins.rstudio.com/reference/board_s3.html, the use of Tagging results in objects being correctly tagged in AWS S3, however when using pins::pin_meta the tags entry is NULL.

This only happens when using the Tagging argument (for both pin_write and pin_upload), when using the tags argument for pin_write (which is not available for pin_upload) it is possible to correctly retrieve the tags metadata using pins::pin_meta.

It does not seem related to permissions, as using paws::s3 and then s3::get_object_tagging allows to retrieve the tag set via the Tagging argument.

I am referring to the following example:

if (FALSE) {
board <- board_s3("pins-test-hadley", region = "us-east-2")
board %>% pin_write(mtcars)
board %>% pin_read("mtcars")

# A prefix allows you to have multiple independent boards in the same pin.
board_sales <- board_s3("company-pins", prefix = "sales/")
board_marketing <- board_s3("company-pins", prefix = "marketing/")
# You can make the hierarchy arbitrarily deep.

# Pass arguments like `Tagging` through the dots of `pin_write`:
board %>% pin_write(mtcars, Tagging = "key1=value1&key2=value2")

}

(pins version 1.2.2)

Best, Michael

juliasilge commented 7 months ago

Ah yep, I can see how that would be confusing in this situation. They are separate and different tag-like entities.

If you want to have your Tagging values also show up as pins tags, you would need to do something like this:

board %>% pin_write(mtcars, Tagging = "key1=value1&key2=value2", tags = c("value1", "value2"))

It's a bit unfortunate that the names (S3-specific and pins-specific) of these are so similar. 😕 Maybe we can improve the documentation to be less confusing.

michaelhogersnplm commented 7 months ago

Hi @juliasilge thank you for the quick response! I think for pin_write the tagging logic works as expected (in that case I was only using the tags argument which would result in pin::pin_meta working as expected and the S3 tags looking correct), but when using pin::pin_upload I can only use the Tagging argument, tags is not available it seems. I just happen to be writing some test logic around the object tags for both methods

juliasilge commented 7 months ago

Ah yep, great point! I outlined what we need to check in #805; take a look if you like and share any other thoughts. 👍

github-actions[bot] commented 7 months ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.