gpt4 book ai didi

python - PowerBI .pbix DataMashup 压缩目录

转载 作者:行者123 更新时间:2023-12-05 06:23:32 27 4
gpt4 key购买 nike

我正在尝试使用 python 的 zipfile 库检查 PowerBI .pbix 文件。

解压缩 .pbix 存档时,我得到以下结构:

DataMashup
DataModel
DiagramLayout
Metadata
Report
ReporLayout
ReporStaticResources
ReporStaticResourceSharedResources
ReporStaticResourceSharedResourceBaseThemes
ReporStaticResourceSharedResourceBaseThemeCY18SU07.json
SecurityBindings
Settings
Version
[Content_Types].xml

看来 .pbix 存档中的 DataMashup 文件是目录的某种非品牌存档。

DataMashup 对象似乎没有被压缩,因为在 python 解释器中打印对象时我可以轻松读取 xml 数据。

使用 7zip 我可以访问其中的所有内容:

DataMashup/
Config/
Package.xml
Formulas/
Section1.m # m and/or dax looking stuff
[Content_Types].xml

如何发现DataMashup archive-within-an-archive 的格式?

一个线索在 DataMashup 对象顶部的二进制数据中:\x00\x00\x00\x00\x07\x05\x00\x00PK 这可能指示 pkzip。

另一个线索可能是在 DataMashup 文件上尝试使用 unzip 时的输出:

$ unzip DataMashup
Archive: DataMashup
warning [DataMashup]: 6215 extra bytes at beginning or within zipfile

我能够使用 7za 在 Linux 上解压缩 DataMashup 目录:

WARNINGS:
There are data after the end of archive

--
Path = DataMashup
Type = zip
WARNINGS:
There are data after the end of archive
Offset = 8
Physical Size = 1303
Tail Size = 5148

Everything is Ok

Archives with Warnings: 1

Warnings: 1
Files: 3
Size: 2040
Compressed: 6459

尽管有警告,但文件看起来没问题。不幸的是,这对我在 Windows 上没有帮助。

最佳答案

pbix 文件是压缩文件,因此需要解压缩文件。 DataMashup 遵循 MS-QDEFF规范。

存档中的 DataMashup 文件也是一个存档,它包含具有查询源定义的 Section1.m

  1. 更改文件section1.m
  2. 重新打包DataMashup
  3. 重新压缩并将扩展名更改回 xlsx

这是一个非常好的c#教程

https://www.titanwolf.org/Network/q/8acb9f29-4b28-400b-b8df-cbe523edcb01/y

这里还有一个,使用power shell

https://querypower.medium.com/extracting-power-queries-41fd73d3d6a2

关于python - PowerBI .pbix DataMashup 压缩目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58242805/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com