Skip to content

Commit

Permalink
Adds custom data types method for Snowflake DBs (#451)
Browse files Browse the repository at this point in the history
Co-authored-by: Jim Hester <james.f.hester@gmail.com>
  • Loading branch information
edgararuiz and jimhester authored Apr 1, 2021
1 parent e3c3c85 commit d19370c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# odbc (development version)

* New `odbcDataType.Snowflake()` method for Snowflake databases. (@edgararuiz, #451)

# odbc 1.3.1

* Fixed warnings about anonymous unions (@detule, #440)
Expand Down
18 changes: 18 additions & 0 deletions R/DataTypes.R
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,24 @@ odbcDataType.Oracle <- function(con, obj, ...) {
)
}

#' @export
`odbcDataType.Snowflake` <- function(con, obj, ...) {
switch_type(
obj,
factor = "VARCHAR(255)",
datetime = "TIMESTAMP",
date = "DATE",
time = "TIME",
binary = "VARBINARY(255)",
integer = "INTEGER",
double = "DOUBLE PRECISION",
character = "VARCHAR(255)",
logical = "BOOLEAN",
list = "VARCHAR(255)",
stop("Unsupported type", call. = FALSE)
)
}

switch_type <- function(obj, ...) {
switch(object_type(obj), ...)
}
Expand Down

0 comments on commit d19370c

Please sign in to comment.