When connecting to an MSSQL Server, we can have several databases from which we can pull data. To get the quoting straight, one has to add an additional sql call to in_schema to be able to get the data in a particular database, which is not that clear:
library(dbplyr)
(s1 <- in_schema("mydatabase.myschema", "mytable"))
## <SCHEMA> `mydatabase.myschema`.`mytable`
(s2 <- in_schema(sql("mydatabase.myschema"), "mytable"))
## <SCHEMA> mydatabase.myschema.`mytable`
# library(dplyr)
# con <- dbConnect(odbc::odbc(), "mydatabase_server")
# tbl(con, s1) ## will not work
# tbl(con, s2) ## will work
Admittedly, my knowledge of standard SQL is mediocre at best, so there may be very good reasons for not adding a catalog/database parameter to in_schema, but at least the proper way of addressing a table in a schema in a catalog / database should be documented somewhere. w/o SO I would yet not have any idea of how to pull data with the fully qualified name.
Thus, either we add that to the docs or even add a new parameter to in_schema.
When connecting to an MSSQL Server, we can have several databases from which we can pull data. To get the quoting straight, one has to add an additional
sqlcall toin_schemato be able to get the data in a particular database, which is not that clear:Admittedly, my knowledge of standard SQL is mediocre at best, so there may be very good reasons for not adding a
catalog/databaseparameter toin_schema, but at least the proper way of addressing a table in a schema in a catalog / database should be documented somewhere. w/o SO I would yet not have any idea of how to pull data with the fully qualified name.Thus, either we add that to the docs or even add a new parameter to
in_schema.