Forum Discussion
How to create semantic model from lakehouse sql endpoint using REST API
I want to create semantic model using rest api from Lakehouse SQL point or tables but dont find any documentation to create semantic model using REST API.
Can anyone help me to create semantic model from lakehouse (sql endpoint or files or tables) using REST API
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.
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.
7 Replies
- svenchioSuper User
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.
- Mestu_PaulHelper II
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-sgandrathiCommunity 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.
- jennrattenSuper User
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.
- jennrattenSuper User
Mestu_Paul Thanks for the kudo! If this post helps to answer your questions, please consider marking it as a solution so others can find it more quickly when faced with a similar challenge.
Proud to be a Microsoft Fabric Super User!
- v-sgandrathiCommunity Support
Hi Mestu_Paul,
Thank you svenchio and svenchio for your response to the query,
Has your issue been resolved?If the response from the community member answered your query, please consider confirming it. If you have any further questions, feel free to reach out!
Thank you. - v-sgandrathiCommunity Support
Hi Mestu_Paul,
Just wanted to follow up and confirm that everything has been going well on this. Please let me know if thereโs anything from our end.
Please feel free to reach out Microsoft fabric community forum.