Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write_dwc() returns error: Expecting a single string value: [type=character; extent=0]. #293

Closed
rubenpp7 opened this issue Jun 21, 2024 · 8 comments · Fixed by #294
Closed
Assignees
Labels
bug Something isn't working

Comments

@rubenpp7
Copy link

Hi,

I'm trying to run the following code but it gives me an error, could you take a look?
data <- write_dwc(con, "2010_phd_reubens")
Error
Reading data and transforming to Darwin Core. Error: Expecting a single string value: [type=character; extent=0].

Thanks!

@peterdesmet
Copy link
Member

Hi @rubenpp7 are you using the latest version of etn?

I noticed another bug in write_dwc() (does not create an output). @sannegovaert or @PietrH can you investigate? We will need this function fairly soon to transform data for DTO BioFlow.

@rubenpp7
Copy link
Author

Hi @peterdesmet

yes, I made sure that I had the latest version but the issue persists

@PietrH PietrH self-assigned this Jun 21, 2024
@PietrH PietrH added the bug Something isn't working label Jun 21, 2024
@PietrH
Copy link
Member

PietrH commented Jun 21, 2024

I'm looking into this, I'll post updates in this issue.

@PietrH
Copy link
Member

PietrH commented Jun 21, 2024

I have found the cause of the issue, we are failing on this line:

etn/R/write_dwc.R

Lines 85 to 88 in 326d9e8

dwc_occurrence_sql <- glue::glue_sql(
readr::read_file(system.file("sql/dwc_occurrence.sql", package = "etn")),
.con = connection
)

Fix is in progress.

@PietrH
Copy link
Member

PietrH commented Jun 21, 2024

I suspect this actually broke when one of our dependencies glue got updated to v1.7.0: https://github.com/tidyverse/glue/releases/tag/v1.7.0 as part of tidyverse/glue#272.

rights_holder is set to NULL by default, resulting in an empty sql query being returned by glue::glue_sql(), setting rights_holder to "NULL" results in valid sql being returned.

I'm making headway.

@PietrH
Copy link
Member

PietrH commented Jun 21, 2024

Fixed in branch, I'm opening a PR.

@PietrH PietrH linked a pull request Jun 21, 2024 that will close this issue
@PietrH
Copy link
Member

PietrH commented Jun 21, 2024

@peterdesmet Could you review the PR?

@PietrH
Copy link
Member

PietrH commented Jun 21, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants