Skip to content

Query worked in 2.3.4 but not in 2.4.0 #1388

Description

@carlinstarrs

This used to work:

library("dbplyr")
cn <- DBI::dbConnect(odbc::odbc(), .connection_string = "Driver={SQL Server};server=servername;trusted_connection=yes;")
dplyr::tbl(cn, dbplyr::in_schema(dbplyr::sql("database.dbo"), dbplyr::sql("table_name")))

But now gets this error message:

Caused by error:
! nanodbc/nanodbc.cpp:1769: 42000: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'database.dbo.table_name'.  [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. 
<SQL> 'SELECT *
FROM "database.dbo"."table_name" "q01"
WHERE (0 = 1)'

The update to 2.0 also broke our queries that included the database name within in_schema (see #552), and we've been using this workaround since then, but now the workaround is broken. Any chance this is something that would get fixed? The issue is the extra quotes around the . after dbo, i.e. the query should be:

'SELECT *
FROM "database.dbo.table_name" "q01"
WHERE (0 = 1)'

Reverting to 2.3.4 fixes it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions