Skip to main content

Parse, validate and document your Power BI Project

Project description

pbipinspect

Parse, validate and document your Power BI Project

Installation

pip install pbipinspect

Usage

This library brings your Power BI project to a structured and validated state. It provides a set of tools to analyze, validate, and document your project.

First, you need to create a inspect. The create_inspect function takes a path to your project and returns a PbipInspect object. You can create directly with PbipInspect class, but create_inspect is recommended.

>>> from pbipinspect import create_inspect
>>> inspect = create_inspect('your-project.pbip')

Inspect parse you Power BI Project and gives you the ability to validate and document it. You can see the model generated from your project acessing the attribute model.

>>> print(inspect.model)
{'model': {
    'tables': [{
        'name': 'table',
        'lineageTag': 'id',
        'columns': [{...}],
        'measures': [{...}],
        'partitions': [{...}],
        'isHidden': False,
        'annotations': [{...}]
    }],
    'relationships': [{...}]
}}

Now, it's possible to validate your project. This is possible thanks to expects. Pbipinspect already comes with some expects that you can use to validate your project.

>>> from pbipinspect.expectations import *
>>> inspect.expectations(steps=[
...     expect_col_starts_with(col_type='dateTime', pattern='dt_', state='Info'),
...     expect_measure_starts_with(pattern='m_'),
...     expect_table_starts_with(pattern='t_'),
...     expect_table_name_no_spaces(),
...     expect_cols_in_relationship_has_same_type(),
...     expect_dax_lines_length(max_length=60),
...     expect_m_lines_length(max_length=60),
...     expect_measures_in_specific_table('_measures'),
...     expect_no_calculated_columns(state='Error'),
...     expect_all_relationships_active()
>>> ])
>>> inspect.run_expectations()
>>> print(inspect.expects)
[{'expect': 'expect_col_starts_with',
   'state': 'Warning',
   'message': "Column 'Column1' in table 'Table1' must start with 'dt_'"},
 {'expect': 'expect_no_calculated_columns',
  'state': 'Error',
  'message': "Table 'Table1' has calculated columns: 'Column2' and 'Column3'"}
]

Getting help

If you encounter a clear bug, please file an issue with a minimal reproducible example on GitHub.

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

pbipinspect-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

pbipinspect-0.1.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file pbipinspect-0.1.0.tar.gz.

File metadata

  • Download URL: pbipinspect-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pbipinspect-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6790b96fecd4d87881c8372f6124dd81358fb1eb3fd870a1b3f6fe093f3d8148
MD5 d805ac4afbee4b9c940c8cf0583d4854
BLAKE2b-256 8139725484d49b421b5b1f7f64179e5d1f182317db08ce33baab99a2ea81f41e

See more details on using hashes here.

File details

Details for the file pbipinspect-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pbipinspect-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for pbipinspect-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5eb150a0aa6e0574f38e0c95f7b6ee890eba66fc019ab719693239e735095b1f
MD5 81d8c4a76b37c6ef03cb84984682675f
BLAKE2b-256 c9d4a5d895971e3211213ccd17c08757487b91e433dedf47c2ff2682167b35ec

See more details on using hashes here.

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