You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SQL queries generated by dbplyr are not very readable. Of course one can use one of the many available online SQL formatters but it would be still be very nice if the query itself would be more readable.
For example turn this
SELECT`x.x`, `x.y`, `y`FROM (SELECT`x.x`, `x.y`, `y`, AVG(`x.x`) OVER (PARTITION BY `y`) AS`q01`FROM (SELECT`LHS`.`x`AS`x.x`, `RHS`.`x`AS`x.y`, `y`FROM`dbplyr_001`AS`LHS`LEFT JOIN`dbplyr_002`AS`RHS`ON (LHS.x<RHS.x)
))
WHERE (`q01`>1.0)
into something like this
SELECT`x.x`,
`x.y`,
`y`FROM
(SELECT`x.x`,
`x.y`,
`y`,
AVG(`x.x`) OVER (PARTITION BY `y`) AS`q01`FROM
(SELECT`LHS`.`x`AS`x.x`,
`RHS`.`x`AS`x.y`,
`y`FROM`dbplyr_001`AS`LHS`LEFT JOIN`dbplyr_002`AS`RHS`ON (LHS.x<RHS.x)))
WHERE (`q01`>1.0)
I looked around a little for existing R packages providing an SQL formatter but there seems to hardly any. I found sqlparseR which has quite a lot of extra Python dependencies.
dbplyr could directly generate pretty SQL code but this would probably require quite a bit of work and maintenance. So, it might be easier to create a wrapper around an existing SQL formatter.
The text was updated successfully, but these errors were encountered:
The SQL queries generated by
dbplyr
are not very readable. Of course one can use one of the many available online SQL formatters but it would be still be very nice if the query itself would be more readable.For example turn this
into something like this
I looked around a little for existing R packages providing an SQL formatter but there seems to hardly any. I found sqlparseR which has quite a lot of extra Python dependencies.
dbplyr
could directly generate pretty SQL code but this would probably require quite a bit of work and maintenance. So, it might be easier to create a wrapper around an existing SQL formatter.The text was updated successfully, but these errors were encountered: