-
Notifications
You must be signed in to change notification settings - Fork 177
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
NULL %foo% lhs
is not translated to foo lhs
anymore ?
#1345
Comments
So you mean that previously I see that it would be nice to somehow get the SQL code |
This works, but is a bit clunky: library(dbplyr)
translate_sql(extract(sql("year") %from% 'mydate'), con = simulate_postgres())
#> <SQL> extract(year from 'mydate') Created on 2023-11-02 with reprex v2.0.2 Maybe we could provide built-in |
I remember using this feature extensively in a project, and I have it on my workshop slides somewhere. |
Can we just pass through |
Since this is a regression we can just fix it for 2.4.1. I don't love the syntax, but it works, and there's no obviously better alternative. |
Most likely root cause: https://github.com/tidyverse/dbplyr/pull/1228/files#diff-bffb8f93561affc007b200e783a30fb6b418d48ffa60175ade2a2fc3818bc532 Reprex: library(dbplyr)
translate_sql(extract(NULL %year from% mydate), con = simulate_postgres())
#> <SQL> extract(NULL year from `mydate`) Created on 2024-02-20 with reprex v2.0.2.9000 |
I had the following code and it worked ok (not sure with which version):
Now it is broken, I could fix by changing to:
The translation is
extract(year from("mydate")
.I'm not sure if the previous behavior was documented. I don't see the breaking change idocumented in the NEWS. Was it purposefully disabled ? I thought it was neat.
Note: I just found out that I could just use
year()
(on Oracle), not sure if it's new or not, but tangential to the issue.The text was updated successfully, but these errors were encountered: