dbplyr 2.2.0
dbplyr 2.2.0
New features
-
SQL formatting has been considerably improved with new wrapping and indenting.
show_query()
creates more readable queries by printing the keywords in blue
(@mgirlich, #644). When possible dbplyr now usesSELECT *
instead of
explicitly selecting every column (@mgirlich). -
Added support for
rows_insert()
,rows_append()
,rows_update()
,
rows_patch()
,rows_upsert()
, androws_delete()
(@mgirlich, #736). -
Added
copy_inline()
as acopy_to()
equivalent that does not need write
access (@mgirlich, #628). -
remote_query()
,show_query()
,compute()
andcollect()
have an
experimentalcte
argument. IfTRUE
the SQL query will use common table
expressions instead of nested queries (@mgirlich, #638). -
New
in_catalog()
, which works likein_schema()
, but allows creation of
table identifiers consisting of three components: catalog, schema, name
(#806, @krlmlr).
Improvements to SQL generation
-
When possible, dbplyr now uses
SELECT *
instead of explicitly selecting
every column (@mgirlich). -
Improved translations for specific backends:
as.Date()
for Oracle (@mgirlich, #661).case_when()
with a final clause of the formTRUE ~ ...
usesELSE ...
for SQLite (@mgirlich, #754).day()
,week()
,isoweek()
, andisoyear()
for Postgres (@mgirlich, #675).explain()
for ROracle (@mgirlich).fill()
for SQL Server (#651, @mgirlich) and RPostgreSQL (@mgirlich).quantile()
for SQL Server (@mgirlich, #620).str_flatten()
for Redshift (@hdplsa, #804)slice_sample()
for MySQL/MariaDB and SQL Server (@mgirlich, #617).union()
for Hive (@mgirlich, #663).
-
The backend function
dbplyr_fill0()
(used for databases that lack
IGNORE NULLS
support) now respects database specific translations
(@rsund, #753). -
Calls of the form
stringr::foo()
orlubridate::foo()
are now evaluated in
the database, rather than locally (#197). -
Unary plus (e.g.
db %>% filter(x == +1)
) now works (@mgirlich, #674). -
is.na()
,ifelse()
,if_else()
,case_when()
, andif()
generate slightly more compact SQL (@mgirlich, #738). -
if_else()
now supports themissing
argument (@mgirlich, #641). -
quantile()
no longer errors when using thena.rm
argument (@mgirlich, #600). -
remote_name()
now returns a name in more cases where it makes sense
(@mgirlich, #850). -
The partial evaluation code is now more aligned with
dtplyr
. This makes it
easier to transfer bug fixes and new features from one package to the other.
In this process the second argument ofpartial_eval()
was changed to a lazy
frame instead of a character vector of variables (@mgirlich, #766).
Partially evaluated expressions with infix operations are now correctly
translated. For exampletranslate_sql(!!expr(2 - 1) * x)
now works
(@mgirlich, #634).
Minor improvements and bug fixes
-
New
pillar::tbl_format_header()
method for lazy tables: Printing a lazy
table where all rows are displayed also shows the exact number of rows in the
header. The threshold is controlled bygetOption("pillar.print_min")
,
with a default of 10 (#796, @krlmlr). -
The 1st edition extension mechanism is formally deprecated (#507).
-
across()
,if_any()
andif_all()
now defaults to.cols = everything()
(@mgirlich, #760). If.fns
is not providedif_any()
andif_all()
work
like a parallel version ofany()
/any()
(@mgirlich, #734). -
across()
,if_any()
, andif_all()
can now translate evaluated lists
and functions (@mgirlich, #796), and accept the name of a list of functions
(@mgirlich, #817). -
Multiple
across()
calls inmutate()
andtransmute()
can now access
freshly created variables (@mgirlich, #802). -
add_count()
now doesn't change the groups of the input (@mgirlich, #614). -
compute()
can now handle whenname
is named by unnaming it first
(@mgirlich, #623), and now works whentemporary = TRUE
for Oracle
(@mgirlich, #621). -
explain()
passes...
to methods (@mgirlich, #783), and
works for Redshift (@mgirlich, #740). -
filter()
throws an error if you supply a named argument (@mgirlich, #764). -
Joins disambiguates columns that only differ in case (@mgirlich, #702).
New argumentsx_as
andy_as
allow you to control the table alias
used in SQL query (@mgirlich, #637). Joins withna_matches = "na"
now work
for DuckDB (@mgirlich, #704). -
mutate()
andtransmute()
use named windows if a window definition is
used at least twice and the backend supports named windows (@mgirlich, #624). -
mutate()
now supports the arguments.keep
,.before
, and.after
(@mgirlich, #802). -
na.rm = FALSE
only warns once every 8 hours across all functions (#899). -
nesting()
now supports the.name_repair
argument (@mgirlich, #654). -
pivot_longer()
can now pivot a column namedname
(@mgirlich, #692),
can repair names (@mgirlich, #694), and can work with multiplenames_from
columns (@mgirlich, #693). -
pivot_wider(values_fn = )
andpivot_longer(values_transform = )
can now be formulas (@mgirlich, #745). -
pivot_wider()
now supports the argumentsnames_vary
,names_expand
, and
unused_fn
(@mgirlich, #774). -
remote_name()
now returns a name in more cases where it makes sense
(@mgirlich, #850). -
sql_random()
is now exported. -
ungroup()
removes variables in...
from grouping (@mgirlich, #689).