dbplyr icon indicating copy to clipboard operation
dbplyr copied to clipboard

Incorrect translation of dates with Oracle ODBC.

Open edonnachie opened this issue 1 year ago • 1 comments

When translating a date to SQL with an ODBC connection to an Oracle database, dbplyr returns SQL of the form "DATE 2024-02-27". This is incorrect and leads to the error "Failed to collect lazy table".

dbplyr should should translate o valid Oracle SQL of the form to_date('2024-2-07', 'YYYY-MM-DD')

This problem did not arise when using the ROracle package, which I, like Oracle, have now all but abandoned.

Example; With db as an odbc connection to an Oracle database (Formal class 'Oracle' [package "odbc"]:

 dbplyr::translate_sql(X > as.Date("2024-01-01"), con=db)
# Returns: <SQL> "X" > DATE 2024-01-01

edonnachie avatar Feb 27 '24 13:02 edonnachie

I had a similar problem, the issue is fixed in #1389 and in the dev-version of the package.

Thranholm avatar Mar 04 '24 21:03 Thranholm