Skip to main content

A Python library to parse and analyze PBIX files used with Microsoft Power BI.

Project description

PBIXRay

Downloads

Overview

PBIXRay is a Python library designed to parse and analyze PBIX files, which are used with Microsoft Power BI. This library provides a straightforward way to extract valuable information from PBIX files, including tables, metadata, Power Query code, and more.

This library is the Python implementation of the logic embedded in the DuckDB extension duckdb-pbix-extension.

Installation

Before using PBIXRay, ensure you have the following Python modules installed: apsw, kaitaistruct, and pbixray. You can install them using pip:

pip install pbixray

Getting Started

To start using PBIXRay, import the module and initialize it with the path to your PBIX file:

from pbixray import PBIXRay

model = PBIXRay('path/to/your/file.pbix')

Features and Usage

Tables

To list all tables in the model:

tables = model.tables
print(tables)

Metadata

To get metadata about the Power BI configuration used during model creation:

metadata = model.metadata
print(metadata)

Power Query

To display all M/Power Query code used for data transformation, in a dataframe with TableName and Expression columns:

power_query = model.power_query
print(power_query)

M Parameters

To display all M Parameters values in a dataframe with ParameterName, Description, Expression and ModifiedTime columns:

m_parameters = model.m_parameters
print(m_parameters)

Model Size

To find out the model size in bytes:

size = model.size
print(f"Model size: {size} bytes")

DAX Calculated Tables

To view DAX calculated tables in a dataframe with TableName and Expression columns:

dax_tables = model.dax_tables
print(dax_tables)

DAX Measures

To access DAX measures in a dataframe with TableName, Name, Expression, DisplayFolder, and Description columns:

dax_measures = model.dax_measures
print(dax_measures)

Calculated Columns

To access calculated column DAX expressions in a dataframe with TableName,ColumnName and Expression columns:

dax_columns = model.dax_columns
print(dax_columns)

Schema

To get details about the data model schema and column types in a dataframe with TableName, ColumnName, and PandasDataType columns:

schema = model.schema
print(schema)

Relationships

To get the details about the data model relationships in a dataframe with FromTableName, FromColumnName, ToTableName, ToColumnName, IsActive, Cardinality, CrossFilteringBehavior, FromKeyCount, ToKeyCount and RelyOnReferentialIntegrity columns:

relationships = model.relationships
print(relationships)

Row-Level Security (RLS)

To get the details about Row-Level Security roles and permissions in a dataframe with TableName, RoleName, RoleDescription, FilterExpression, State and MetadataPermission columns:

rls = model.rls
print(rls)

Get Table Contents

To retrieve the contents of a specified table:

table_name = 'YourTableName'
table_contents = model.get_table(table_name)
print(table_contents)

Statistics

To get statistics about the model, including column cardinality and byte sizes of dictionary, hash index, and data components, in a dataframe with columns TableName, ColumnName, Cardinality, Dictionary, HashIndex, and DataSize:

statistics = model.statistics
print(statistics)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pbixray-0.4.0.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pbixray-0.4.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file pbixray-0.4.0.tar.gz.

File metadata

  • Download URL: pbixray-0.4.0.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pbixray-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4d49eeb71815e6bbf4b68979133b2d355438c16548cdf587489c2d22a41d53db
MD5 90d286aa80f1f180937488687f9f1e79
BLAKE2b-256 1b85ed55c5f2cbeace3cbdcfa33d7c2b3ec9265ccaf89e46dc2294cad3243911

See more details on using hashes here.

Provenance

The following attestation bundles were made for pbixray-0.4.0.tar.gz:

Publisher: publish.yml on Hugoberry/pbixray

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pbixray-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: pbixray-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pbixray-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35f6c9476e0fbe4eb7a7d841c2883f7f6c21396f40f55d9aca0ddf784e51c8f2
MD5 7162d471d544b755e13d455ed7ae780a
BLAKE2b-256 6bed1bbad68fb8b3bbdc7a0409e6f50099e306ebd2726835a2644e92c062c558

See more details on using hashes here.

Provenance

The following attestation bundles were made for pbixray-0.4.0-py3-none-any.whl:

Publisher: publish.yml on Hugoberry/pbixray

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page