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

get_tables_from_sql.lazy_base_remote_query not working #274

Closed
willshen99 opened this issue Nov 7, 2024 · 1 comment
Closed

get_tables_from_sql.lazy_base_remote_query not working #274

willshen99 opened this issue Nov 7, 2024 · 1 comment

Comments

@willshen99
Copy link

I installed RPresto from current github repo. My dbplyr version is 2.5.0.

tbl(con, 'table_name') is not working. Full backtrace:

Error in `as_table_path()`:
! `con` is absent but must be supplied.
---
Backtrace:
     ▆
  1. ├─base (local) `<fn>`(x)
  2. └─dbplyr:::print.tbl_sql(x)
  3.   ├─dbplyr:::cat_line(format(x, ..., n = n, width = width, n_extra = n_extra))
  4.   │ ├─base::cat(paste0(..., "\n"), sep = "")
  5.   │ └─base::paste0(..., "\n")
  6.   ├─base::format(x, ..., n = n, width = width, n_extra = n_extra)
  7.   └─pillar:::format.tbl(x, ..., n = n, width = width, n_extra = n_extra)
  8.     └─pillar:::format_tbl(...)
  9.       └─pillar::tbl_format_setup(...)
 10.         ├─pillar:::tbl_format_setup_dispatch(...)
 11.         └─pillar:::tbl_format_setup.tbl(...)
 12.           └─pillar:::df_head(x, n + 1)
 13.             ├─base::as.data.frame(head(x, n))
 14.             └─dbplyr:::as.data.frame.tbl_sql(head(x, n))
 15.               ├─base::as.data.frame(collect(x, n = n))
 16.               ├─dplyr::collect(x, n = n)
 17.               └─RPresto:::collect.tbl_presto(x, n = n)
 18.                 └─dbplyr::db_sql_render(dbplyr::remote_con(x), x)
 19.                   ├─dbplyr::db_sql_render(con, sql, ..., sql_options = sql_options)
 20.                   └─RPresto:::db_sql_render.PrestoConnection(con, sql, ..., sql_options = sql_options)
 21.                     └─RPresto:::find_cte_tables_from_lazy_query(con, sql$lazy_query)
 22.                       ├─base::unique(get_tables_from_sql(sql))
 23.                       ├─RPresto:::get_tables_from_sql(sql)
 24.                       └─RPresto:::get_tables_from_sql.lazy_select_query(sql)
 25.                         ├─RPresto:::get_tables_from_sql(query$x)
 26.                         └─RPresto:::get_tables_from_sql.lazy_base_remote_query(query$x)
 27.                           └─(utils::getFromNamespace("table_path_name", "dbplyr"))(query$x)
 28.                             └─dbplyr::as_table_path(x, con)
@willshen99
Copy link
Author

willshen99 commented Nov 7, 2024

The issue is due to this line

  if (inherits(query$x, "dbplyr_table_path")) { # dbplyr >= 2.5.0
    utils::getFromNamespace("table_path_name", "dbplyr")(query$x)

as_table_path should take both x and con.

willshen99 referenced this issue Nov 8, 2024
I don't _think_ there should be any other problems, but if you could run your tests with dev dbplyr installed, I'd certainly appreciate it.
@willshen99 willshen99 changed the title tbl() not working -- Error in as_table_path(): ! con is absent but must be supplied. get_tables_from_sql.lazy_base_remote_query not working Nov 13, 2024
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

2 participants