Help automating table name change in Direct Lake mode #473
Replies: 6 comments 5 replies
-
If you want to repoint a table in your direct lake semantic model to a different delta table in the lakehouse, use this function: |
Beta Was this translation helpful? Give feedback.
-
Interesting. Thanks for the detailed feedback. I made a PR (#487) to ensure that the source lineage tag is updated accordingly when the update function is executed. Hopefully that fixes it. This is one of those nuances which make working with TOM and the semantic model web experience a bit funky. The fix will be in the next release. |
Beta Was this translation helpful? Give feedback.
-
Related problem - Tables disappearing from Semantic Model when trying to refresh data, if Model Tables were pointed to a specific Lakehouse Table using sempy_labs.directlake.update_direct_lake_partition_entity. Encountered this in Power BI Desktop. Opened the DL Model in Edit mode in PBI Desktop, hit "Refresh Data" for a table and then after refresh all the tables that had been pointed to a LH table with this function disappeared. |
Beta Was this translation helpful? Give feedback.
-
Please wait for the fix discussed in this discussion to go live in 0.9.4. Then run this function again. |
Beta Was this translation helpful? Give feedback.
-
I am not able to reproduce this error. I updated table/partition in a direct lake model to point to a new lakehouse table using the function, opened Power BI Desktop and connected to the direct lake model in Edit mode and the relationship with that table still exists. Could you give me the exact scenario/steps taken? |
Beta Was this translation helpful? Give feedback.
-
This happened when, after connecting to DL model in Edit mode, I run refresh data on either that table or the whole model. Full Scenario:
If it helps, before 0.9.4, the behavior was that all tables updated with this function disappeared from the model entirely. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Thank you for making this library available! My company is in the midst of migrating to MS Fabric from Alteryx, Tableau, and Business Objects. It is a bit like learning to build a car as we build the car and drive down the freeway going 70mph. I spent several hours this week trying to solve what SHOULD be a simple problem.
We have several delta tables that were created with the incorrect naming convention, however we already have semantic models and reports built on these tables. We are trying to leverage direct lake models as much as possible.
I have been using semantic-link-labs for a great many things, so I thought maybe I could script this process there.
First I tried sempy_labs.directlake.add_table_to_direct_lake_semantic_model(), that did not work because apparently schema enabled lakehouses are not supported in that function yet.
I then tried a combination of sempy_labs.tom.add_table(). This did indeed add a table, but it was blank (no columns) and showed up as a direct query mode, not direct lake.
So then I went into the model via the UI and manually added the new table I had created with the new name. That brought over all of the columns.
That then enabled me to use sempy_labs.tom.update_columns() to update all of the columns with the metadata from the columns of the old table.
I was then also able to move a measure from the old fact table to the new fact table by using sempy_labs.tom.remove_object() and sempy_labs.tom.add_measure(). I even used the old lineage tag from the measure I removed in the new measure hoping this would keep the vizzes from breaking. However, it did not. Vizzes in the power bi report broke because the relationships did not exist to the new table as they did on the old table.
Then I manually fixed the relationships so the measures would work. The moved measure did work as expected, but the vizzes that were using the measure still showed that the "measure was removed from the model".
I then tried to use sempy_labs.report.get_report_json(), in the hopes that I could modify the report somehow, but that didn't work because the Fabric service only seems to store the .pbix and not the .pbib that get_report_json() requires.
At this point, I'm at a loss; I feel like this is a pretty common scenario and there HAS to be a better option than: add table, re-do all relationships, add back column settings, move all measures to this new table, manually open each measure and replace references to the old table with references to the new table.
Thank you for your time reading this very lengthy comment. Reiterating again, these models are all in Direct Lake mode and the goal is to update the Power bi report file and/or semantic model to utilize the renamed table in the place of the existing table. There could be some cases where the table changed slightly, but for the most part it will have the same column names and metadata as well as the same measures and relationships.
Thank you very much for your time and I hope you have an easier answer to what must be a common issue for anybody building in Fabric right now!
Beta Was this translation helpful? Give feedback.
All reactions