Search code examples
rdplyrdbplyr

Getting a table from a schema from sql with a backslash


So I have to get a table which is in a schema in a database. The schema name contains a backslash, e.g david\b.

I have my connection con so I use dbplyr

tabel <- dplyr::tbl(con, in_schema("david\\b", "some_tabel"))

But this does not work.


Solution

  • Every database I know would only possibly allow a backslash in a quoted identifier. So I think you need to include the double quotes as well as the (escaped) backslash:

    in_schema('"david\\b"', "some_tabel")
    

    If you click on the links in my comment, they all pretty much say identifiers (like table and schema names) can only include letters, numbers, _ and (sometimes) $ and @. Unless the identifier is quoted.