Does Power BI parameters are exposed to Python globals

此生再无相见时 提交于 2020-01-05 05:40:25

问题


I'm working on Power BI requests with Python scripting. I'm able to get the dataset through dataset global variable, but now I'd like to be able to get the passed parameters directly in my Python script.

I tried to "print" (we cannot really print directly in PowerBI so I use raise Exception(WhatIWantToDebug) in order to see my error directly in PowerBI) the globals(), which show all the globals variables declared accessible in the context of the Python script, but I'm not able to find anything concerning parameters. I'm able to see dataset though.

Thanks in advance for your solutions ideas


回答1:


I've finally find a solution to my problem. So I didn't figure out how to get parameters directly in Python.

But instead of that I create parameters, let's say parameters A, B, C. To use it in Python, I create a request with the source :

= Table.FromColumns({{A}, {B}, {C}}, {"parameterA", "parameterB", "parameterC"})

After that, my parameters are accessible in the dataset dict with pandas

parameterA = dataset['parameterA'][0])
parameterB = dataset['parameterB'][0])
parameterC = dataset['parameterC'][0])

Hope it helps you



来源:https://stackoverflow.com/questions/56461168/does-power-bi-parameters-are-exposed-to-python-globals

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!