Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions R/backend-postgres.R
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,14 @@ sql_translation.PqConnection <- function(con) {
postgres_period(x, "hours")
},
days = function(x) {
# lubridate::days() (base::days() does not exist)
postgres_period(x, "days")
},
weeks = function(x) {
postgres_period(x, "weeks")
},
months = function(x) {
# base::months() (or applicable methods from lubridate, e.g., months.numeric)
postgres_period(x, "months")
},
years = function(x) {
Expand Down
6 changes: 3 additions & 3 deletions R/backend-snowflake.R
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,7 @@ sql_translation.Snowflake <- function(con) {
str_squish = function(string) {
sql_expr(regexp_replace(trim(!!string), "\\\\s+", " "))
},


# lubridate functions
# date functions (e.g., from lubridate or ?base::weekdays)
# https://docs.snowflake.com/en/sql-reference/functions-date-time.html
day = function(x) {
sql_expr(EXTRACT(DAY %FROM% !!x))
Expand Down Expand Up @@ -188,12 +186,14 @@ sql_translation.Snowflake <- function(con) {
glue_sql2(sql_current_con(), "INTERVAL '{.val x} hour'")
},
days = function(x) {
# lubridate::days() (base::days() does not exist)
glue_sql2(sql_current_con(), "INTERVAL '{.val x} day'")
},
weeks = function(x) {
glue_sql2(sql_current_con(), "INTERVAL '{.val x} week'")
},
months = function(x) {
# base::months() (or applicable methods from lubridate, e.g., months.numeric)
glue_sql2(sql_current_con(), "INTERVAL '{.val x} month'")
},
years = function(x) {
Expand Down