mrc-ide / orderly2

https://mrc-ide.github.io/orderly2/
Other
7 stars 2 forks source link

`orderly_metadata_extract(..., extract = "jibberish")` returns empty column #159

Open jeffeaton opened 3 months ago

jeffeaton commented 3 months ago

Specifying to extract a column that doesn't exist just returns an empty column name if I try to extract a column that doesn't exist:

> orderly_metadata_extract(extract = "jibberish")
                        id jibberish
1 20240704-225610-cc4efc1c          

Would be helpful for that to throw an error if not one of the keys.

richfitz commented 3 months ago

It might be helpful in some contexts, but not in others, so it does not do this.

If we adopted the suggested change then the function will become hard to reason about, because if you happen to run a metadata extraction that does not have any information for a valid query, then the function fails and its impossible to predict when you run the function if that should have happened or not. If you want to error if you fail to recover information you should perhaps throw yourself