microsoft / semantic-link-labs

Early access to new features for Microsoft Fabric semantic link.
MIT License
64 stars 4 forks source link

sempy_labs.get_semantic_model_bim - Cannot get dataset from other App Workspaces #26

Open GilbertQue opened 4 days ago

GilbertQue commented 4 days ago

Hi Michael,

Thanks once again for all your amazing work and assistance.

I tried the sempy_labs.get_semantic_model_bim which works fine if I am using a dataset in the same workspace.

When I try and access a dataset in a different app workspace I get the following error below.

The thing to note is that to matter which App Workspace I change it to, it always errors with the same ID "ValueError: There's no item with the ID '260cc545-9a59-45a7-9897-fb705d4bc4ae'"

image

Here is the code that I am using:

# Script out Database

dataset_name =  "4.Security"
workspace_name = "Presso's"

df = sempy_labs.get_semantic_model_bim(dataset = dataset_name, workspace = workspace_name , save_to_file_name = "/lakehouse/default/Files/mymodel.bim")
m-kovalsky commented 3 days ago

This appears to be because the workspace in which the dataset exists is different than the workspace in which the lakehouse (attached to the notebook) exists. Is that the case?

GilbertQue commented 3 days ago

Hi Michael,

Yes, that is correct. I thought when I put in the workspace and the dataset in the same workspace it should then return the model.bim?

Ideally, I want to run a notebook in Fabric enabled App Workspace but get the model.bim from a Power BI Premium Per user app workspace.

m-kovalsky commented 3 days ago

The error doesn't occur regarding the dataset's workspace. It occurs because the lakehouse's workspace is different. I can add a parameter for the lakehouse workspace and that should take care of it. Right now it's trying to look up the lakehouse within the dataset's workspace and it can't find it so it yields an error.

m-kovalsky commented 3 days ago

Also, I believe I will have to update this function as I am only seeing TMDL files (no .bim) from the API that this function uses.

GilbertQue commented 3 days ago

That would be great to have the additional parameter. I'm happy to just keep the TMDL format. Thank you

m-kovalsky commented 3 days ago

The additional parameter will be in the next version. I think I will also add another parameter which will allow either getting the bim or getting the tmdl files. Will probably have to update the function name in that case to something like 'get_semantic_model_definition'.

GilbertQue commented 3 days ago

That would be awesome thank you!