dbplyr 2.4.0
Breaking changes
-
Using
compute(temporary = FALSE)
without providing a name is now
deprecated (@mgirlich, #1154). -
ntile()
's first argument has been renamed fromorder_by
tox
to
match the interface ofdplyr::ntile()
(@mgirlich, #1242). -
simulate_vars()
andsimulate_vars_is_typed()
were removed as they weren't
used and tidyselect now offerstidyselect_data_proxy()
and
tidyselect_data_has_predicates()
(@mgirllich, #1199). -
sql_not_supported()
now expects a function name without parentheses. -
sql_query_append()
,sql_query_insert()
,sql_query_update()
,
sql_query_upsert()
, andsql_query_delete()
changed their arguments to
make them more consistent to the othersql_query_*()
functions:x_name
was renamed totable
.y
was renamed tofrom
and must now be a table identifier or SQL instead
of a lazy table.sql_query_append()
andsql_query_insert()
have gained the argumentcols
.
-
remote_name()
now returns a string with the name of the table. To get the
qualified identifier use the newly addedremote_table()
(@mgirlich, #1280). -
tbl_lazy()
losessrc
argument after it has been deprecated for years
(@mgirlich, #1208). -
translate_sql()
now requires thecon
argument (@mgirlich, #1311).
Thevars
argument has been removed after it threw an error for the last 7
years (@mgirlich).
Improved SQL
-
Preliminary databricks Spark SQL backend (#1377).
-
Joins
-
*_join()
now allows specifying the relationship argument. It must be
NULL
or"many-to-many"
(@bairdj, #1305). -
Queries now qualify
*
with the table alias for better compatibility
(@mgirlich, #1003). -
full_join()
can now handle column names that only differ in case
(@ejneer, #1255). -
The
na_matches
argument ofsemi_join()
andanti_join()
works again
(@mgirlich, #1211). -
A
semi/anti_join()
on fitleredy
is inlined when possible (@mgirlich, #884). -
Joins now work again for Pool and Oracle connections (@mgirlich, #1177, #1181).
-
A sequence of
union()
resp.union_all()
now produces a flat query
instead of subqueries (@mgirlich, #1269). -
Added translations for:
-
if_any()
andif_all()
translations are now wrapped in parentheses.
This makes sure it can be combined via&
with other conditions
(@mgirlich, #1153). -
nth()
,first()
, andlast()
now support thena_rm
argument
(@mgirlich, #1193).
Minor improvements and bug fixes
-
across()
now supports namespaced functions, e.g.
across(x, dplyr::dense_rank)
(@mgirlich, #1231). -
db_copy_to(overwrite = TRUE)
now actually works. -
db_copy_to()
's...
are now passed todb_write_table()
(@mgirlich, #1237). -
Added
db_supports_table_alias_with_as()
to customise whether a backend
supports specifying a table alias withAS
or not (@mgirlich). -
db_write_table()
anddb_save_query()
gain theoverwrite
argument. -
dbplyr_pivot_wider_spec()
is now exported. Unlikepivot_wider()
this can
be lazy. Note that this will be removed soon afterpivot_wider_spec()
becomes a generic (@mgirlich). -
filter()
ing with window functions now generates columns calledcol01
rather thanq01
(@mgirlich, #1258). -
pivot_wider()
now matches tidyrNA
column handling (@ejneer #1238). -
select()
can once again be used afterarrange(desc(x))
(@ejneer, #1240). -
show_query()
andremote_query()
gain the argumentsql_options
that allows
to control how the SQL is generated. It can be created viasql_options()
which has the following arguments:cte
: use common table expressions?use_star
: useSELECT *
or explicitly select every column?qualify_all_columns
: qualify all columns in a join or only the ambiguous ones?
(@mgirlich, #1146).
Consequently the
cte
argument ofshow_query()
andremote_query()
has
been deprecated (@mgirlich, #1146). -
slice_min/max()
can now order by multiple variables like dplyr, e.g. use
slice_min(lf, tibble(x, y))
(@mgirlich, #1167). -
slice_*()
now supports the data masking pronouns.env
and.data
(@mgirlich, #1294). -
sql_join_suffix()
gains the argumentsuffix
so that methods can check
whether the suffix is valid for the backend (@mgirlich). -
sql_random()
is now deprecated. It was used to powerslice_sample()
which
is now done via the translation forrunif()
(@mgirlich, #1200). -
tbl()
now informs when the user probably forgot to wrap the table identifier
within_schema()
orsql()
(@mgirlich, #1287).
Backend specific improvements
-
Access
-
DuckDB
- now supports the
returning
argument ofrows_*()
.
- now supports the
-
MySQL/MariaDB:
rows_update()
androws_patch()
now give an informative error when the
unsupportedreturning
argument is used (@mgirlich, #1279).rows_upsert()
now gives an informative error that it isn't supported
(@mgirlich, #1279).rows_*()
use the column types ofx
when auto copyingy
(@mgirlich, #1327).copy_inline()
now works (@mgirlich, #1188).- Fix translation of
as.numeric()
,as.POSIXct()
,as_datetime()
, and
as.integer64()
(@avsdev-cw, #1189).
-
MS SQL:
row_number()
now works when no order is specified (@ejneer, @fh-mthomson, #1332)
-
Oracle:
- Fix translation of
rows_upsert()
(@mgirlich, @TBlackmore, #1286) head(n)
is now translated toWHERE ROWNUM <= n
to also support old
versions <= 11.2 (@JeremyPasco, #1292).
- Fix translation of
-
Postgres
-
SQLite
- Subqueries now also get an alias. This makes it consistent with other
backends and simplifies the implementation.
- Subqueries now also get an alias. This makes it consistent with other
-
SQL Server
-
Snowflake:
na.rm = TRUE
is now respected inpmin()
andpmax()
instead of being silently ignored (@fh-mthomson, #1329)row_number()
now works when no order is specified (@fh-mthomson, #1332)
-
Teradata
distinct()
+head()
now work (@mgirlich, #685).as.Date(x)
is now translate toCAST(x AS DATE)
again unlessx
is a
string (@mgirlich, #1285).row_number()
no longer defaults to partitioning by groups (now aligned with other databases when no order is specified:ROW_NUMBER()
defaults toORDER BY (SELECT NULL)
) (@fh-mthomson, #1331)