DyfanJones / noctua

Connect R to Athena using paws SDK (DBI Interface)
https://dyfanjones.github.io/noctua/
Other
45 stars 5 forks source link

update dbplyr 2+ api version support #173

Closed DyfanJones closed 2 years ago

DyfanJones commented 2 years ago

Current noctua uses several dbplyr backend functions for it's dplyr integration. However with dbplyr v2+, several currently used dbplyr backend functions are getting deprecated in dbplyr-2.2.0 (https://dbplyr.tidyverse.org/articles/backend-2.html). This PR is to add support for dbplyr 2+ without losing current dbplyr 1 backend support

DyfanJones commented 2 years ago

dbplyr::tbl api has changed and forces method dbplyr:::db_query_fields.DBIConnection when getting field names from database. This is ok for most databases however this is not performant with AWS Athena (#64).

dplyr:::tbl.DBIConnection
  - dbplyr:::tbl.src_dbi
    - dbplyr:::tbl_sql
      - dbplyr:::dbplyr_query_fields
        - dbplyr:::dbplyr_fallback
           - dbplyr:::db_query_fields.DBIConnection

function (con, sql, ...) 
{
  sql <- sql_query_fields(con, sql, ...)
  names(dbGetQuery(con, sql))
}

To overcome this the Ident method will have to be created in dbGetQuery to keep the same performance when working with dbplyr v2.