Forum Discussion
How to create semantic model from lakehouse sql endpoint using REST API
- 10 months ago
Hello again Mestu_Paul - Do you have a specific requirement to use a lakehouse SQL analytics endpoint and REST API?
If you are really just wanting to create a semantic model using a lakehouse as a source, then this is a good end-to-end tutorial of direct lake for Power BI users: https://learn.microsoft.com/en-us/power-bi/fundamentals/fabric-get-started
If you connect PowerBI to the lakehouse as a lakehouse (which is stored in OneLake), the storage mode for the model will be direct lake. This will allow you to avoid the SQL analytics endpoint and REST APIs, which simplifies the process and provides a more reliable and performant connection.
The tutorial demonstrates creating the model from within the lakehouse, which means it is created in the cloud.
If you prefer using PowerBI desktop, see this page: Learn About Editing Semantic Models in Direct Lake in Power BI Desktop - Microsoft Fabric | Microsoft Learn
I still recommend going through the tutorial though as it shows how to leverage other helpful Fabric artifacts as well.
- 10 months ago
Hi Mestu_Paul I completely agree with the information provided by jennratten, however, it does not address your actual request π "How to create semantic model from lakehouse sql endpoint using REST API" (I don't need to know your reasons, just going to answer your question π )
Well, you will need several things, to achieve the creation of a semantic model via API...
#1. Access to Fabric via Auth. token in this repository, in this article The TMSL to TMDL Switch (Part 2): I Did My Homework! there's the link to a Git repository whit an example that works! I use Power shell
#2. You need to define your semantic model in either TMSL (JSON) or TMDL (YAML-like), what this means is the you need to actually have JSON files as shown in this example using the TMSL format, you can also see that in the model.bim there's the ACTUAL CONNECTION TO THE Lakehouse SQL point !!!
#3. You need to encode this files as 64-bit strings and call the API interface Items - Create Semantic Model - REST API (SemanticModel) | Microsoft Learn with the encoding string as the payload in each of the parts
And BUM! You create a semantic model using API ... Of course to make an actual version of this process requieres some coding, but the code I'm sharing on the repo in my article will GIVE YOU A BIG PUSH IN THE RIGHT DIRECTION.
So, your question has been ANSWERED! This is how you create a semantic model using the API ... please mark this as the answer and kudos for the information would be appreciated.
Hi Mestu_Paul I completely agree with the information provided by jennratten, however, it does not address your actual request π "How to create semantic model from lakehouse sql endpoint using REST API" (I don't need to know your reasons, just going to answer your question π )
Well, you will need several things, to achieve the creation of a semantic model via API...
#1. Access to Fabric via Auth. token in this repository, in this article The TMSL to TMDL Switch (Part 2): I Did My Homework! there's the link to a Git repository whit an example that works! I use Power shell
#2. You need to define your semantic model in either TMSL (JSON) or TMDL (YAML-like), what this means is the you need to actually have JSON files as shown in this example using the TMSL format, you can also see that in the model.bim there's the ACTUAL CONNECTION TO THE Lakehouse SQL point !!!
#3. You need to encode this files as 64-bit strings and call the API interface Items - Create Semantic Model - REST API (SemanticModel) | Microsoft Learn with the encoding string as the payload in each of the parts
And BUM! You create a semantic model using API ... Of course to make an actual version of this process requieres some coding, but the code I'm sharing on the repo in my article will GIVE YOU A BIG PUSH IN THE RIGHT DIRECTION.
So, your question has been ANSWERED! This is how you create a semantic model using the API ... please mark this as the answer and kudos for the information would be appreciated.
Hello svenchio,
Thank you for your response. Actually I want to create semantic model from lakehouse table or sql endpoint.
You write about creating semantic model using rest api, but I need to use lakehouse as datasource. I'm clarifying in main post again
- v-sgandrathi10 months ago
Community Support
Hi Mestu_Paul,
If you want to create a semantic model using Lakehouse tables or the SQL analytics endpoint, the REST API can handle this, but there isnβt a separate βLakehouse API.β You need to set the Lakehouse SQL endpoint as the datasource in your semantic model definition (TMSL/TMDL). Essentially, you create or export a model definition that includes the Lakehouse SQL connection string and table queries, encode it, and submit it using the Items β Create Semantic Model endpoint. The REST API will then create the semantic model based on your definition, and the datasource section determines if it uses Lakehouse. This allows for full automation of semantic model creation from Lakehouse tables, provided your definition refers to the Lakehouse SQL endpoint correctly.
Items - Create Semantic Model - REST API (SemanticModel) | Microsoft Learn
Better Together - the Lakehouse and Warehouse - Microsoft Fabric | Microsoft Learn
Power BI Semantic Models - Microsoft Fabric | Microsoft LearnThank you.