Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Unable to write time into database #203

Open
vhpietil opened this issue Jul 4, 2018 · 0 comments
Open

Unable to write time into database #203

vhpietil opened this issue Jul 4, 2018 · 0 comments

Comments

@vhpietil
Copy link

vhpietil commented Jul 4, 2018

Problem:

Hi,
I read data from SAS-table (.sas7bdat) using haven::read_sas and try to write the table to monetDBlite -database.

I get the error

Error in .local(conn, name, value, ...) : 
  Failed to insert data: MALException:embedded:Could not convert column 0 start_time to type 15

Below is an example with a sample of the start_time-column (printed using dput):

Example:

library(MonetDBLite)
library(DBI)
library(dplyr)

dbdir <- tempdir()

data <- structure(list(start_time = structure(c(43200, 44100, 45000, 
                                                45900, 46800, 47700), 
                                              class = c("hms", "difftime"), 
                                              units = "secs")), 
                  row.names = c(NA, -6L), 
                  class = c("tbl_df", "tbl", "data.frame"), 
                  .Names = "start_time")

con <- dbConnect(MonetDBLite::MonetDBLite(), dbdir)

dbWriteTable(con, "datatable", data)

Sessioninfo:

R version 3.4.1 (2017-06-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.6 (Santiago)

Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] DBI_0.7           dplyr_0.7.4       MonetDBLite_0.5.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.14     codetools_0.2-15 digest_0.6.15    assertthat_0.2.0 R6_2.2.2         magrittr_1.5     rlang_0.2.0      bindrcpp_0.2     tools_3.4.1     
[10] glue_1.2.0       yaml_2.1.14      compiler_3.4.1   pkgconfig_2.0.1  bindr_0.1        tibble_1.3.4    
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant