paleolimbot commented on issue #37860:
URL: https://github.com/apache/arrow/issues/37860#issuecomment-1734359101

   I think the arrow R package implements the `$metadata` shortcut for `Table` 
and `Dataset` objects, whereas pyarrow does not. I think the metadata is there, 
it just needs an extra `.schema`:
   
   ``` r
   library(arrow, warn.conflicts = FALSE)
   
   tf <- tempfile()
   tbl <- arrow_table(iris)
   
   cur_meta <- tbl$metadata
   cur_meta[["test"]] <- "testing other metadata"
   tbl$metadata <- cur_meta
   
   write_dataset(tbl, tf, partitioning = "Species")
   open_dataset(tf)$schema$metadata$test
   #> [1] "testing other metadata"
   
   pa_dataset <- reticulate::import("pyarrow.dataset", convert = FALSE)
   ds <- pa_dataset$dataset(tf)
   ds$schema$metadata$keys()
   #> dict_keys([b'r', b'test'])
   ```
   
   Or in regular Python land:)
   
   ```python
   from pyarrow import dataset
   
   ds = dataset.dataset("path/to/dataset")
   ds.schema.metadata[b"test"]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to