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

Wrong data type for datetime for Spark #555

Closed
schuemie opened this issue Apr 3, 2023 · 0 comments · Fixed by #556
Closed

Wrong data type for datetime for Spark #555

schuemie opened this issue Apr 3, 2023 · 0 comments · Fixed by #556

Comments

@schuemie
Copy link
Contributor

schuemie commented Apr 3, 2023

Issue Description and Expected Result

If I try to insert data containing datetimes into a Spark server, it creates a DATE field and then tries to insert the datetime values into that, causing a Error: nanodbc/nanodbc.cpp:1752: 22008: [Simba][Support] (40520) Datetime field overflow resulting from invalid datetime error.

If would expect a TIMESTAMP field to be created for datetime values.

Database

Tested on DataBricks Spark

Reproducible Example

db <- DBI::dbConnect(odbc::odbc(),
                     Driver = "Simba Spark ODBC Driver",
                     Host = keyring::key_get("dataBricksServer"),
                     uid = keyring::key_get("dataBricksUser"),
                     pwd = keyring::key_get("dataBricksPassword"),
                     HTTPPath = keyring::key_get("dataBricksHttpPath"),
                     SSL = 1,
                     ThriftTransport = 2,
                     AuthMech = 3,
                     Port = keyring::key_get("dataBricksPort"))
DBI::dbWriteTable(
  conn = db,
  name =  DBI::Id(schema = "scratch", table = "insert_test"),
  value = data.frame(dt = Sys.time()),
  overwrite = TRUE,
  append = FALSE
)
# Error: nanodbc/nanodbc.cpp:1752: 22008: [Simba][Support] (40520) Datetime field overflow resulting from invalid datetime

If I change this line to read datetime = "TIMESTAMP",, all is well. I'll create a PR in case you want to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant