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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to update dataflow M scripts from JSON file?

Hi,

I have created a dataflow in a developer workspace, then exported the dataflow as a JSON file and imported the dataflow from the JSON file into a production workspace, all successfully. Then I have made changes to the M code of the dataflow in the dev workspace. Now I want to export the JSON file from dev workspace and update the dataflow in prod workspace with the changed M code from the JSON file.

 

Is there a way to update an existing dataflow from a JSON file instead of creating a new dataflow from the JSON file?

 

The relevant difference is that if I delete the prod dataflow and import the JSON file as new, I would have to change all the datasets depending on the old dataflow to load from the new dataflow ID, which I want to avoid.

 

Thank you very much!

 

BR

Martin

6 REPLIES 6
Anonymous
Not applicable
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

After testing, I think you can try to directly copy the updated M code in development workspace to the Advanced editor of the dataflow in production workspace. That will update an existing dataflow from a JSON file instead of creating a new dataflow from the JSON file.

 

image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @v-kkf-msft ,
Thank you for the support. This is actually what I currently do. But since I have multiple queries that I want to update in the dataflow, this is way more effort than importing all changes from one JSON file at once.

Do you know whether changing the M code of the queries in the dataflow can be automated through Power BI API with Pro or Premium per User license?

Best regards,
Martin 

Hi @Anonymous ,

 

Unfortunately, according to the document https://docs.microsoft.com/en-us/rest/api/power-bi/dataflows , it should be impossible to use Rest API to automatically update the M code.

 

Best Regards,
Winniz

dbeavon3
Continued Contributor
Continued Contributor

@v-kkf-msft this is not correct.  There is a REST api that updates the M/PQ code for dataflows.  It is part of the "imports" API.  It doesn't work very well, and is pretty buggy.  But it is there.

Anonymous
Not applicable

Hi @v-kkf-msft ,

Thank you! This confirms my research. It seems the API doesn't know anything like a "Query" object in a dataflow, only dataflow level settings affecting all queries. I'll submit the JSON update as an idea.
BR
Martin

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors