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

datetime columns that are stored as TEXT and contain 00:00:00 times causes all times to be dropped #39

Open
evanamiesgalonski opened this issue Jun 15, 2023 · 0 comments

Comments

@evanamiesgalonski
Copy link
Member

evanamiesgalonski commented Jun 15, 2023

not an issue when using column type TIMESTAMP in table definition

data <-
  tibble::tibble(
    date_time = as.POSIXct(c("1998-07-08 12:07:00", "1998-07-08 00:00:00"))
  )

data2 <-
  tibble::tibble(
    date_time = as.POSIXct(c("1998-07-08 12:07:00", "1998-07-08 00:00:01"))
  )

# readwritesqlite - 00:00:00 times present
conn <- readwritesqlite::rws_connect()

sql <- "CREATE TABLE data (date_time TEXT NOT NULL)"
DBI::dbExecute(conn, sql)

readwritesqlite::rws_write(data, x_name = "data", conn = conn)
readwritesqlite::rws_read_table("data", conn = conn)

# readwritesqlite - 00:00:00 times NOT present
conn <- readwritesqlite::rws_connect()

sql <- "CREATE TABLE data (date_time TEXT NOT NULL)"
DBI::dbExecute(conn, sql)

readwritesqlite::rws_write(data2, x_name = "data", conn = conn)
readwritesqlite::rws_read_table("data", conn = conn)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants