Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Sign up nowGet Fabric certified for FREE! Don't miss your chance! Learn more
Hi
I am extremely new to Semantic Link Labs - only just learning. I have started working out fabric notebooks and have been exploring a number of codes. Apologies if it has been asked before but I could not find it.
I have come across a stumbling block and had no idea where to ask at all. So I am asking here... as I have found a number of posts on using Semantic link labs - (this post has the code I am using)
I am really struggling with this. I have succesfully created the required lakehouse, run the BPA results and have the table too. However when I try to create a model with the following code -
I have the following error -
add_table_to_direct_lake_semantic_model(dataset, table_name, lakehouse_table_name, refresh, workspace, columns) 210 if any(t.Name == table_name for t in tom.model.Tables): 211 raise ValueError( 212 f"The '{table_name}' table already exists in the '{dataset_name}' semantic model within the '{workspace_name}' workspace." 213 )
I am a bit confused about the table existing already in the dataset, as this is a new dataset. None of the existing datasets should have the same names - is the something I should be checking?
Thanks
Karen
Solved! Go to Solution.
Hi @KarenL7,
It means a semantic model named ModelBPA already exists in that workspace, and at least one table has already been added to it. Sempy Labs (by design) reuse an existing model if the name matches, and does not auto-overwrite or merge. Your next step would be to find the semantic model named ModelBPA, delete it and re-run your code.
One important thing to note (just mentioning) is sempy_labs.create_model_bpa_semantic_model() function defaults dataset to 'ModelBPA' (if not mentioned explicitly).
Hello Everyone
Thank you for everyones reply. I tried again
It all worked I now have a different error so raise a separate error as this is permissions.
Thanks for all your help - not sure whose solution to accept as they all helped!
Thanks
Karen
Hi @KarenL7,
It means a semantic model named ModelBPA already exists in that workspace, and at least one table has already been added to it. Sempy Labs (by design) reuse an existing model if the name matches, and does not auto-overwrite or merge. Your next step would be to find the semantic model named ModelBPA, delete it and re-run your code.
One important thing to note (just mentioning) is sempy_labs.create_model_bpa_semantic_model() function defaults dataset to 'ModelBPA' (if not mentioned explicitly).
Hello @KarenL7
Navigate to OneLake Catalog and apply a filer on Semantic model. If you find a semantic model called ModelBPA, that's why your code has failed.
You can either delete the ModelBPA semantic model or choose to use a different name in your code.
Hi @KarenL7,
Thank you for reaching out to the Microsoft Fabric Community Forum.
The error you are seeing isn’t related to the Lakehouse table, but to an existing semantic model in the workspace. Even if ModelBPA feels like a new dataset, a semantic model with that name was likely created during a previous notebook run or BPA execution. When create_model_bpa_semantic_model() runs again, it attempts to add the same table to that existing model, which causes the “table already exists” error.
To resolve this, either delete the existing semantic model (dataset) named ModelBPA from the workspace and rerun the notebook, or use a new dataset name (for example, ModelBPA_v2).
Hope that clarifies. Let us know if you have any doubts regarding this. We will be happy to help.
Thank you for using the Microsoft Fabric Community Forum.
Hi @KarenL7,
Just wanted to follow up. If the shared guidance worked for you, that’s wonderful hopefully it also helps others looking for similar answers. If there’s anything else you'd like to explore or clarify, don’t hesitate to reach out.
Thank you.
Hi @KarenL7,
Just checking in to see if the issue has been resolved on your end. If the earlier suggestions helped, that’s great to hear! And if you’re still facing challenges, feel free to share more details happy to assist further.
Thank you.
Thank you will be trying agin
Good advice, but please be aware that renaming the new dataset name can have repurcussions if looking to deploy the BPA report as well.
| User | Count |
|---|---|
| 21 | |
| 13 | |
| 8 | |
| 7 | |
| 6 |
| User | Count |
|---|---|
| 75 | |
| 67 | |
| 45 | |
| 20 | |
| 19 |