inbo / etn

R package to access data from the European Tracking Network
https://inbo.github.io/etn/
MIT License
6 stars 5 forks source link

port `write_dwc()` to use API #297

Closed PietrH closed 1 month ago

PietrH commented 2 months ago

Base on vcr branch and immediately implement cached API responses for tests

PietrH commented 2 months ago

write_dwc() is the only function that has a deprecated argument other than connection: directory, this argument is passed in the payload and causing an invalid request to openCPU.

This is because the arguments that should not be passed to the API are hardcoded in the conduct_parent_to_helpers() function:

https://github.com/inbo/etn/blob/ee49b2d1194666a790fa554ac3f00176c2a72351/R/utils.R#L354-L362

It might be better if deprecated arguments could be explicitly passed to this function as arguments, the api argument should never be passed to etnservice

PietrH commented 2 months ago

I can use DBI::dbDisconnect() here, and everywhere, because a connection is created for every query, and then closed again after the query.

In etnservice we had a connection leak causing too much resources to be used and the database to run out of connections. However, there might be a performance penalty.

I'm leaving it in for now.