0

I am wondering how is possible to create a TMSL script from an tabular database (power bi service or SSAS) using some programing language. These kind of scripts are available in several tools, like SSMS or Tabular Editor:

Example of the menu to create TMSL script in SSMS from an active DB

What creates (as an example) something like this:

Example: A TMSL script header for a role

So, the question is if, for example, a python library / .NET wrapper could do that automatically. I am able to send several DMVs using pyadomd to extract the information by parts (with several lookups in alternate tables to transforms ids) and then recompose everything into an script, but if where a easy way to create it could less error prone and time saver.

Thanks in advance Alexis

A Echague
  • 3
  • 1

1 Answers1

0

IT's a .NET Library called Tabular Object Model, which can be used to read Tabular Model metadata and generate scripts using the JSON Scripter.

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67
  • Thanks for the answer! Its a good hint. Looking in that direction I found this blog that talks about how to implement it on python https://dataveld.com/2020/07/22/python-as-an-external-tool-for-power-bi-desktop-part-3-virtual-environments-and-tom-connection/ – A Echague Jun 06 '22 at 17:02
  • Continuing the research: The JsonScripter class can be used on the following way (continuing the implementation showed in that blog): `scripter=TOM.JsonScripter scripter.ScriptCreateOrReplace(TOMServer.Databases[ DB-GUID ]) ` – A Echague Jun 08 '22 at 15:40