Dewey Dunnington (http://twitter.com/paleolimbot) published a really cool way to see how dbplyr translates dplyr into SQL: https://apps.fishandwhistle.net/archives/1503 . Unfortunately it fails with native postgres
although it seems to work fine with odbc_postgres
:
## # A tibble: 13 x 2
## variant n
## <chr> <int>
## 1 dbi 163
## 2 hive 180
## 3 impala 184
## 4 mssql 192
## 5 mysql 113
## 6 odbc 163
## 7 odbc_access 186
## 8 odbc_postgresql 184
## 9 oracle 180
## 10 postgres 1
## 11 sqlite 120
## 12 teradata 190
## 13 test 163
Here's the code I lifted from his site: https://github.com/smithjd/sql-pet/blob/master/book-src/dbplyr-sql-function-translation.R
Here is my attempt to dig into this problem. I would like to list how dplyr generates SQL for each translated function. I can just skip "postgres" but using "odbc_postgresql" just doesn't seem right (since I can't get ODBC to work on my machine and so I never interact with postgres that way!)...