Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
How to connect Fabric lakehouse db from R studio?
We have this requirement to access lakehouse db from within R studio. I searched and didnt find anything related to this, is there any workaround for this currently?
Similar to the above two posts, we've used the ODBC driver. For the proof of concept I used the AZ command line interface (AZCLI) tool to get a token as a user (so authenticating via web client) and then using that token with DBI.
(Incidentally, this is also how I've got the initial Fabric -> Alteryx connection working until I get the ADFS connection behaving)
As an R user i would suggest you to use DBI and dbplyr.
- You can retrieve sql endpoint of that lakehouse
- Create a Service Principal in Azure and use it as a "super user" (https://learn.microsoft.com/it-it/entra/identity-platform/app-objects-and-service-principals?tabs=br...)
# r code:
driver <- "ODBC Driver 18 for SQL Server"
server <- "put here the sql end point of lakehouse"
database <- "lakehouse, ie database name"
authentication <- "ActiveDirectoryServicePrincipal"
encrypt <- "True"
userid <- "id of the Service Principal"
password <- "Password of the Service Principal"
port <- 1433
connection_string <- glue("Driver={driver}; Server={server}; UID={userid}; PWD={password}; Port={port}; Database={database}; Encoding=UTF-8; Authentication={authentication}")
con <- DBI::dbConnect(odbc::odbc(), .connection_string = connection_string)
This is a clean way and you can read tables also from outside MS Fabric, however, as far as I discovered, you won't be able to write but only to read
Hi, @Vinodh247
The following post tries to use RStudio to connect to Endpoint, you can try to test the connection using her method, whether this can give you inspiration.
Microsoft Fabric to RStudio Desktop - RStudio IDE - Posit Community
Also, the current version of Notebook supports the use of Visual Studio, so you can try using it too.
Best Regards,
Yang
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Check out the October 2024 Fabric update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
12 | |
5 | |
4 | |
3 | |
2 |
User | Count |
---|---|
20 | |
12 | |
11 | |
7 | |
5 |