Storing a Table: Support Date column types for Synapse DATE Columns

Description

It seems like synapser isn't properly handling R Date objects when storing Synapse Tables.

You can reproduce using the example code below:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 library(synapser) library(magrittr) PUBLIC_PROJ <- "syn11657334" PUBLIC_TABLE <- "syn18684597" synLogin() test_df <- synTableQuery(paste("select * from", PUBLIC_TABLE))$asDataFrame() %>% dplyr::mutate(createdOn = lubridate::as_date(createdOn), metadata.startDate = lubridate::as_datetime(metadata.startDate), metadata.endDate = lubridate::as_datetime(metadata.endDate)) %>% dplyr::select(-ROW_ID, -ROW_VERSION) test_cols <- list(Column(columnType = "DATE", name = "createdOn"), Column(columnType = "DATE", name = "metadata.startDate"), Column(columnType = "DATE", name = "metadata.endDate")) test_schema <- Schema(name = uuid::UUIDgenerate(), columns = test_cols, parent = PUBLIC_PROJ) synStore(Table(test_schema, test_df))

Which throws:

1 2 Error in (function (list, synapseType) : Cannot convert type Date to a DATE .

I ran into this error when trying to write a reproducible example for different error I was seeing:

1 2 Error in (function (list, synapseType) : Cannot convert type character to a DATE .

Even though all the columns in the dataframe that were being stored to DATE Synapse columns were either of class "Date" or ("POSIXct" "POSIXt").

I'm using synapser 0.6.56

Environment

None

Status

Assignee

Unassigned

Reporter

Phil Snyder

Labels

None

Validator

None

Release Version History

None

Components

Affects versions

synapser-0.6

Priority

Major
Configure