prestodb / RPresto

DBI-based adapter for Presto for the statistical programming language R.
Other
131 stars 41 forks source link

`copy_to` is adding extra `"` to table name #272

Open willshen99 opened 1 week ago

willshen99 commented 1 week ago

I am creating a Trino table from a select statement on another Trino table. It renders the wrong sql script which adds extra " wrapping the table name.

httr::set_config(
  httr::config(
    httpauth=1,
    userpwd='user:password',
    ssl_verifypeer=0
  )
)

con = DBI::dbConnect(
  drv = RPresto::Presto(),
  host="https://trinohost",
  port=8443,
  user=user,
  password=password,
  catalog="hive",
  schema=my_schema,
  bigint="numeric"
)

person <- dplyr::tbl(con, "person")

dplyr::copy_to(dest = con, df = person, name = "person_new")

The sql it renders:

CREATE TABLE """person_new""" AS SELECT * FROM "person"

The table_name got created is "person_new" instead of person.

dplyr::tbl(con,'person')  # failed
dplyr::tbl(con,'"person_new"') # succeed

Version:

Browse[1]> packageVersion('RPresto')
[1] ‘1.4.6’
Browse[1]> packageVersion('dbplyr')
[1] ‘2.5.0’
Browse[1]> packageVersion('DBI')
[1] ‘1.2.2’
Browse[1]> packageVersion('dplyr')
[1] ‘1.1.4’
willshen99 commented 1 week ago

Seems a compatibility issue with dbplyr 2.5.0. It works fine after I downgrade dbplyr to 2.4.0