Convert Oracle table to dataframe in R

418 Views Asked by At

I am trying to convert an Oracle database table into an "R" data frame.

I am using the dplyr::tbl function as well as dbplyr::in_schmema to connect to the specific schema and table within the Oracle database.

Table <- dplyr::tbl(my_oracle, dbplyr::in_schema('SCHEMA_NAME', 'TABLE_NAME'))

This is the part that confuses me as the result is an object called "Table" that is a "List of 2" as seen below. The two items within the list are also lists of two.

enter image description here

I am able to convert this to a data frame by wrapping it with as.data.frame like this:

Table2 <- as.dataframe(dplyr::tbl(my_oracle, dbplyr::in_schema('SCHEMA_NAME', 'TABLE_NAME')))

However, when I do this i takes a very long time (hours for some tables) to convert to a data frame. I am wondering if there is a more efficient way to achieve the outcome of converting the Oracle table into a usable data frame?

Also any insight into why dplyr::tbl results in a list of lists would also be very appreciated.

Thanks in advance.

0

There are 0 best solutions below