Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
FJESPE3
Regular Visitor

I want to obtain data from the datamodelschema with Python and fails

Good morning,

I am trying to open a Power BI desktop metadata file with Python, specifically the datamodelschema.

When executing:

# Reemplaza 'tu_archivo.txt' con la ruta de tu archivo DataModelSchema
ruta_archivo = 'Cruta del archivo/tu_archivo.txt'

# Cargar el contenido del archivo DataModelSchema
with open(ruta_archivo, 'r') as archivo:
data_model_schema = json.load(archivo)

The script fails and says that has "," unexpected.

3 REPLIES 3
FJESPE3
Regular Visitor

Thank you very much, but this is not what I am referring to. When you have the datamodelschema file of Power BI Desktop metadata, it comes in a Python format and does not allow for proper decompression. On one hand, we have seen that it was in a UTF-16 LE format and we have converted it to utf-8 (we are in Spain and it was saved in an American format). The problem we now face is that there are parts that are nested more than twice and it gives us an error. Has anyone been able to read it correctly?

I have the same problem with the Layout file, where we have the label relationship of the visual object with the semantic model field.

Anonymous
Not applicable

Hi @FJESPE3 ,

Perhaps you can refer to Part 4 of the following article on getting Python as an external tool to get metadata for Power BI models.

https://dataveld.com/2020/07/20/python-as-an-external-tool-for-power-bi-desktop-part-1/

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.