Skip to content

orderly_pull_archive() error with when task name has trailing "/" #260

@jeffeaton

Description

@jeffeaton

orderly_pull_archive("task/") throws an error when the task name has a trailing /:

> orderly::orderly_pull_archive("bdi_data_areas/")
[ info       ]  Writing initial orderly archive version as 1.1.25
[ pull       ]  bdi_data_areas/:20201024-115335-68b89939
[ import     ]  bdi_data_areas/:20201024-115335-68b89939
Error: FOREIGN KEY constraint failed

It works fine if you simply remove the trailing /:

> orderly::orderly_pull_archive("bdi_data_areas")
[ pull       ]  bdi_data_areas:20201024-115335-68b89939
[ import     ]  bdi_data_areas:20201024-115335-68b89939

So not that big of a deal, except that I always forget what the issue is and spend ages trying to debug before I remember. @r-ash thinks it might be an error in DBI rather than an orderly issue, but in either case it would be nice to either:

  1. Automatically strip the trailing \ so it just works, or
  2. Catch the error and return an error message guiding user to remove the trailing / and try again.

I'm not sure how to make a generic example with an archive, but I think you should have access to naomi-orderly sharepoint archive for this example:

system("git clone git@github.com:mrc-ide/naomi-orderly")
setwd("naomi-orderly")

## Error with trailing /
orderly::orderly_pull_archive("bdi_data_areas/")

## Works fine if remove the trailing /
orderly::orderly_pull_archive("bdi_data_areas")

Here's what I see from console:

> system("git clone git@github.com:mrc-ide/naomi-orderly")
Cloning into 'naomi-orderly'...
remote: Enumerating objects: 926, done.        
remote: Counting objects: 100% (926/926), done.        
remote: Compressing objects: 100% (613/613), done.        
remote: Total 2718 (delta 499), reused 679 (delta 311), pack-reused 1792        
Receiving objects: 100% (2718/2718), 36.12 MiB | 1.40 MiB/s, done.
Resolving deltas: 100% (1537/1537), done.
> setwd("naomi-orderly")
> orderly::orderly_pull_archive("bdi_data_areas/")
[ info       ]  Writing initial orderly archive version as 1.1.25
[ pull       ]  bdi_data_areas/:20201024-115335-68b89939
[ import     ]  bdi_data_areas/:20201024-115335-68b89939
Error: FOREIGN KEY constraint failed
> orderly::orderly_pull_archive("bdi_data_areas")
[ pull       ]  bdi_data_areas:20201024-115335-68b89939
[ import     ]  bdi_data_areas:20201024-115335-68b89939
> 
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.6

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5               xml2_1.3.2               magrittr_2.0.1          
 [4] orderly.sharepoint_0.1.1 bit_4.0.4                spud_0.1.7              
 [7] R6_2.5.0                 rlang_0.4.9              blob_1.2.1              
[10] httr_1.4.2               tools_4.0.2              DBI_1.1.0               
[13] withr_2.3.0              ellipsis_0.3.1           yaml_2.2.1              
[16] bit64_4.0.5              digest_0.6.27            tibble_3.0.4            
[19] lifecycle_0.2.0          crayon_1.3.4             vctrs_0.3.6             
[22] curl_4.3                 memoise_1.1.0            glue_1.4.2              
[25] RSQLite_2.2.1            orderly_1.2.19           compiler_4.0.2          
[28] pillar_1.4.7             jsonlite_1.7.2           pkgconfig_2.0.3         

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions