Skip to content

[FR] Allow database name in in_schema  #806

@thothal

Description

@thothal

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions