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
Pandadev
Post Prodigy
Post Prodigy

unable to run python code on a combined table to export the table to a csv

I have created a table which is built by apending multiple tables. But when I try to add a python script to apend this table to a csv everytime there is a refresh , I get an error 

Formula.Firewall: Query 'Summary' (step 'Added Conditional Column') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.

in the advanced editor here is what my code looks like , cant work out what I am doing wrong

let
Source = Table.Combine({#"Futures_0-2_days", #"Futures_0-5_days", #"Futures_6-14_days", #"Futures_15-31_days", #"Futures 30 days preceeded by N3", #"Futures 30 days preceeded by O3"}),
#"Run Python script" = Python.Execute("d = pandas.DataFrame(dataset)#(lf) #(lf)d.to_csv('C:\QC Checker\QC Checker Metrics.csv, index=False)#(lf)",[dataset=Source]),
in
#"Run Python script"

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @Pandadev 

 

The tables in power query can be recongnized as pandas object directly, so you can simply call other tables by calling relevant pandas object. I'd like to suggest you refer to the following link to see if it helps

 

How to use Python with mutiple tables in the Power Query Editor 

 

Best Regards

Allan

 

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

View solution in original post

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hi, @Pandadev 

 

The tables in power query can be recongnized as pandas object directly, so you can simply call other tables by calling relevant pandas object. I'd like to suggest you refer to the following link to see if it helps

 

How to use Python with mutiple tables in the Power Query Editor 

 

Best Regards

Allan

 

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

amitchandak
Super User
Super User

@Pandadev , this statement should have one more single quote

 

.to_csv('C:\QC Checker\QC Checker Metrics.csv, index=False)

 

like

.to_csv('C:\QC Checker\QC Checker Metrics.csv', index=False)

I still get this error Formula.Firewall: Query 'Futures Summary' (step 'Run Python script') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.

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.