简体   繁体   English

使用 python 更改 Power BI 参数

[英]Changing Power BI parameters with python

We have a default Power BI file (template), in which we perform a query to obtain the database through a parameter with the name of the database, for example: “database_client_X”.我们有一个默认的 Power BI 文件(模板),我们在其中执行查询以通过带有数据库名称的参数获取数据库,例如:“database_client_X”。 But we have several clients, each client with its own Power BI file and its own database.但是我们有几个客户端,每个客户端都有自己的 Power BI 文件和自己的数据库。

Whenever we add a new client, we automatically generate a folder with the name of that client, copy the default file, throw it in that folder and rename the file to the name of the client.每当我们添加一个新客户端时,我们会自动生成一个具有该客户端名称的文件夹,复制默认文件,将其放入该文件夹并将文件重命名为该客户端的名称。 Thus, we would have, for example, the folder “Client_A”, with the file “Client_A”.因此,例如,我们将拥有文件夹“Client_A”和文件“Client_A”。

The problem is that the Power BI file of this client A is a renamed copy of the default file, and that is why its parameter with the database name is defined as “database_client_X”, the objective then is that in some automated way we can change this parameter to “database_client_A” and update the file.问题是这个客户端 A 的 Power BI 文件是默认文件的重命名副本,这就是为什么它的数据库名称参数定义为“database_client_X”,目标是我们可以以某种自动化方式更改将此参数设置为“database_client_A”并更新文件。

I couldn't find a method to perform this automation, currently we have to open the file, edit the parameter manually and wait for the file to update.我找不到执行此自动化的方法,目前我们必须打开文件,手动编辑参数并等待文件更新。 A simple solution would be something like defining this parameter in python itself and some command/function to update the base, but I can't find libraries or documentation on how to perform these processes within a Python code.一个简单的解决方案就像在 python 本身中定义这个参数和一些命令/函数来更新基础,但我找不到关于如何在 Python 代码中执行这些过程的库或文档。

There's no API to modify.PBIX files.没有 API 可以修改.PBIX 文件。 There is an API to modify the parameters after the.PBIX file is published to the Power BI service. .PBIX文件发布到Power BI服务后,有一个API修改参数。

Datasets - Update Parameters In Group 数据集 - 更新组中的参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM