Connecting Dremio Spaces using R

How can we access Dremio Spaces using R?

This should be possible, see here: R ODBC Connection. Please let us know if you run into any problems.

Could you say a bit more about what you’re trying to do?

You can see in this tutorial how to connect to Dremio from R using a dataframe: https://www.dremio.com/tutorials/analyzing-book-reviews-sql-dremio-r/

The specific query passed to Dremio is:

SELECT * FROM BX-Join-Grouped

The default context for a query is your home space, and in this example the dataset is stored there. Dremio uses a hierarchical namespace model, so to query a dataset in a specifc space you would include it in the name:

SELECT * FROM space_name.BX-Join-Grouped

Spaces can also contain sub-folders, and that works under the same model:

SELECT * FROM space_name.folder_name.sub_folder_name.BX-Join-Grouped

Does that answer your question?

1 Like

Hi,

Thanks for the reply.

What you have answered is correct. But while connecting the spaces from R- I am getting the following error,

Error: HY000 1040 [Dremio][Connector] (1040) Dremio failed to execute the query: select * from dremio.CDR_Refined_Data
[30029]Query execution error. Details:[
VALIDATION ERROR: Table ‘CDR_Refined_Data’ not found.

In above query the virtual dataset as CDR_Refined_Data under the space named as dremio which i can able to access from the UI but couldn’t in R.

And also I can able to connect all the sources in the UI as well as from R which i have added and getting the results.

Please help me out.

Hi @SenthilKumarJ in Dremio UI, could you navigate to the dataset you are trying to query, once the preview loads, hover over the dataset name on the upper left hand side and click on the clipboard icon:
image

This will copy the full path of the dataset in Dremio – you should be able to confirm if this matches what you have in the query. Also, can you try querying other datasets (in spaces or sources) from R?

Can you try running sqlTables(channel) (where channel is the name of your odbcDriverConnect channel) and see if the table is present?
Another thing to try might be writing SELECT * FROM "dremio"."CDR_REFINED_DATA", in other words, putting quotations around everything.