Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function tbl doesn't work anymore #658

Closed
DrFabach opened this issue May 27, 2021 · 7 comments
Closed

function tbl doesn't work anymore #658

DrFabach opened this issue May 27, 2021 · 7 comments

Comments

@DrFabach
Copy link

I use dbplyr to extract information from an oracle database with odbc driver.
I download last version of dbplyr and dyplr and since yesterday i got some errors with tbl().

My connection is active in rstudio and i am able to see the table i want to work with .
I am able to use sql to get data from table.

When i use this fonction

tbl(con, in_schema("schema","table"))

I got the following error :

Erreur : nanodbc/nanodbc.cpp:1655: 42S02: [Oracle][ODBC][Ora]ORA-00942: table or view does not exist

'SELECT *
FROM ("schema"."table") "q01"
WHERE (0 = 1)'

@DrFabach DrFabach changed the title tunction tbl doesn't work anymore function tbl doesn't work anymore May 27, 2021
@einarhjorleifsson
Copy link

I am aware that with dbplyr version 2 schema and table name calls have become case sensitive.
so if table name is e.g. all-caps this no longer works:

tbl(con, in_schema("schema", "table"))

but this does:

tbl(con, in_schema("SCHEMA", "TABLE"))

may this be bugging you?
e

@DrFabach
Copy link
Author

Thank you for your answer
I already tried it and this give me this error :

Erreur : nanodbc/nanodbc.cpp:1655: HY000: [Oracle][ODBC][Ora]ORA-00933: SQL command not properly ended

'SELECT *
FROM ("SCHEMA"."REPONSE_TEXTE_LONG")
FETCH FIRST 11 ROWS ONLY'

I cannot collect() data.

@DrFabach
Copy link
Author

The error come frome the "FETCH FIRST 11 ROWS ONLY"

@DrFabach
Copy link
Author

DrFabach commented May 28, 2021

issue is reported here : #27

I find a dirty way to correct it.

I changed the function dbplyr:::sql_query_select.Oracle
from :
function (con, select, from, where = NULL, group_by = NULL, having = NULL, order_by = NULL, limit = NULL, distinct = FALSE, ..., subquery = FALSE) { sql_select_clauses(con, select = sql_clause_select(con, select, distinct), from = sql_clause_from(con, from), where = sql_clause_where(con, where), group_by = sql_clause_group_by(con, group_by), having = sql_clause_having(con, having), order_by = sql_clause_order_by(con, order_by, subquery, limit), limit = if (!is.null(limit)) { build_sql("FETCH FIRST ", as.integer(limit), " ROWS ONLY", con = con) }) }

to

function (con, select, from, where = NULL, group_by = NULL, having = NULL, order_by = NULL, limit = NULL, distinct = FALSE, ..., subquery = FALSE) { sql_select_clauses(con, select = sql_clause_select(con, select, distinct), from = sql_clause_from(con, from), where = sql_clause_where(con, where), group_by = sql_clause_group_by(con, group_by), having = sql_clause_having(con, having), order_by = sql_clause_order_by(con, order_by, subquery, limit), limit = if (!is.null(limit)) { if (!length(where) == 0) { build_sql("AND ROWNUM <= ", as.integer(limit), con = con) } else { build_sql("WHERE ROWNUM <= ", as.integer(limit), con = con) } }) }

@DrFabach DrFabach closed this as completed Jun 4, 2021
@fschiefenhoevel
Copy link

Hi!

is there a way you could help me to implement your solution in the current dbplyr version? I am stuck with the same problem (oracle 11 not being supported, FETCH FIRST not working), and I can't fix it with your code (since dbplyr has changed too much, I guess)

@mgirlich
Copy link
Collaborator

This is fixed in the dev version which should be released to CRAN soon.

@fschiefenhoevel
Copy link

ahh, that would be supergood. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants