greenplum-db / PivotalR-archive

An convenient R tool for manipulating tables in PostgreSQL type databases and a wrapper of Apache MADlib.
https://pivotalsoftware.github.io/gp-r/
125 stars 53 forks source link

Missing dataframe in as.db.data.frame error not specific #55

Open dotcomken opened 6 years ago

dotcomken commented 6 years ago

The current error as shown in R:

Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘as.db.data.frame’ for signature ‘"function

While debugging the error using as.db.data.frame I learned the dataframe I was using was not in the environment. Would suggest making this error more specific to missing data.

fmcquillan99 commented 6 years ago

Thanks, we will update the error message to be clearer.

orhankislal commented 6 years ago

@dotcomken Could you give the steps to repro this issue? I tried a very simple case of missing data frame but it gives a different error.

> n = c(2, 3, 5)
> s = c("aa", "bb", "cc")
> b = c(TRUE, FALSE, TRUE)
> df = data.frame(n, s, b)
> w <- as.db.data.frame(df, "df_from_r", conn_id = 1)
Counting and caching the data table dimension ... 0.009 sec ... done.
An R object pointing to "df_from_r" in connection 1 is created !

The data in the data.frame df is stored into "df_from_r" in database madlib-pg94 on 127.0.0.1 !
> w <- as.db.data.frame(df2, "df_from_r2", conn_id = 1)
Error in as.db.data.frame(df2, "df_from_r2", conn_id = 1) :
  object 'df2' not found