{"id":45748,"library":"pbixray","title":"pbixray","description":"A Python library to parse and analyze PBIX files used with Microsoft Power BI and Excel PowerPivot. It allows you to extract data models, measures, relationships, Power Query M code, and report metadata from Power BI files. Current version: 0.10.0.","status":"active","version":"0.10.0","language":"python","source_language":"en","source_url":"https://github.com/Hugoberry/pbixray","tags":["power-bi","pbix","data-model","dax","power-query"],"install":[{"cmd":"pip install pbixray","lang":"bash","label":"Install pbixray"}],"dependencies":[{"reason":"For loading environment variables (optional in quickstart)","package":"python-dotenv","optional":true}],"imports":[{"wrong":"from pbixray import PBIX","symbol":"PBIXRay","correct":"from pbixray import PBIXRay"},{"symbol":"DataMashup","correct":"from pbixray import DataMashup"},{"symbol":"MQuery","correct":"from pbixray import MQuery"}],"quickstart":{"code":"import os\nfrom pbixray import PBIX\n\n# Load a PBIX file\nfile_path = os.environ.get('PBIX_PATH', 'path/to/your/file.pbix')\nif not os.path.exists(file_path):\n    raise FileNotFoundError(f'File not found: {file_path}')\n\npbix = PBIX(file_path)\n\n# Access data model tables\nprint(pbix.data_model.tables[0].name)  # First table name\n\n# Access measures\nfor measure in pbix.data_model.measures:\n    print(measure.name, measure.expression)\n\n# Access relationships\nfor rel in pbix.data_model.relationships:\n    print(rel.name, rel.from_table, rel.to_table, rel.from_column, rel.to_column)\n\n# Close the PBIX object\npbix.close()","lang":"python","description":"Load a PBIX file, inspect tables, measures, and relationships."},"warnings":[{"fix":"Call `pbix.close()` after processing, or use a context manager (not yet implemented).","message":"The PBIX file must be closed with `pbix.close()` to release file handles. Failing to close may cause file locking issues on Windows.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure the PBIX file is directly from Power BI Desktop, not from the service.","message":"pbixray only works with PBIX files created by Power BI Desktop. Power BI Service export files (unpacked) are not supported.","severity":"gotcha","affected_versions":"all"},{"fix":"Check `hasattr(pbix, 'data_model')` before accessing.","message":"Accessing `pbix.data_model` may raise an AttributeError if the PBIX file has no data model (e.g., pure report without queries).","severity":"gotcha","affected_versions":"all"},{"fix":"Do not rely on the structure of report JSON; use with caution.","message":"The `pbix.report` attribute for parsing report layout (JSON) is experimental and may change in future versions.","severity":"deprecated","affected_versions":"<0.11"}],"env_vars":null,"search_vec":"'0.10.0':41 'allow':20 'analyz':8 'bi':15,37,44 'code':31 'current':39 'data':24,47 'data-model':46 'dax':49 'excel':17 'extract':23 'file':10,38 'librari':4 'm':30 'measur':26 'metadata':34 'microsoft':13 'model':25,48 'pars':6 'pbix':9,45 'pbixray':1 'power':14,28,36,43,51 'power-bi':42 'power-queri':50 'powerpivot':18 'python':3 'queri':29,52 'relationship':27 'report':33 'use':11 'version':40","created_at":"2026-06-07T12:56:31.845866+00:00","updated_at":"2026-06-07T12:56:31.845866+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/Hugoberry/pbixray","github":"https://github.com/Hugoberry/pbixray","docs":null,"changelog":null,"pypi":null,"npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["analytics"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-08-02","install_tag":null}}