cboettig / minioclient

R Interface to the MINIO client
https://cboettig.github.io/minioclient/
Other
19 stars 3 forks source link

Inconsistent behaviour of mc_cp, mc_head and mc_sql on windows #15

Open fileunderwater opened 3 months ago

fileunderwater commented 3 months ago

I have an issue where mc_cp() and mc_head() works well and is recognizing an s3-alias (as seen by mc_alias_ls()), but mc_sql() is trying to access a local folder when providing the same alias/path, instead of the minio storage.

This works (creating a local file): mc_cp(from = "kthb/indicators/units.csv", to = "c:/temp/units.csv") as well as: units_head<- mc_head("kthb/indicators/units.csv")

However, when using mc_sql the result only contains an error message: units<- mc_sql("kthb/indicators/units.csv")

Error message: "Unable to run sql for kthb/indicators/units.csv." Requested pathC:\Users\xxx\git\repo1\kthb\indicators\units.csvnot found C:\\Users\\xxx\\git\\repo1\\kthb\\indicators\\units.csv Using Windows 11, R 4.2.2 and minioclient 0.0.5

mskyttner commented 3 months ago

It may be caused by mc_sql and mchead omitting to provide the --config-dir flag unlike other mc* functions which do (since they dispatch via the mc()-function which does this). The settings for the alias(es) can as a consequence not be resolved and as a result the target spec is interpreted as a local filepath rather than an "s3 filespec".

cboettig commented 2 months ago

thanks, precisely. mc_sql should be doing:

https://github.com/cboettig/minioclient/blob/c71a990dc3a47dab37b9ff37f9f6e2d8c654da4f/R/mc.R#L30-L32

PR welcome, otherwise hopefully I get to this soon and apologies for the delay.