Forum Discussion

falguni's avatar
falguni
New Member
1 year ago
Solved

Custom Best Practice Analyzer (BPA)

I am seeking assistance with creating a custom Best Practice Analyzer (BPA) to ensure that my environment adheres to specific best practices that are not covered by the built-in BPA rules. Currently...
  • nilendraFabric's avatar
    1 year ago

    Hello falguni 

    try this approach 

     Start by outlining the specific best practices you want to enforce. These could include optimizing DAX expressions, ensuring proper data types, or maintaining naming conventions.

     Use JSON for Rule Definition: BPA rules are defined in JSON format. 

     

    Use`sempy_labs.create_model_bpa_semantic_model()` to generate a semantic model for analysis. This function links the BPA results with the `modelbparesults` delta table in your Fabric lh

     

    import sempy_labs as sl

    sl.create_model_bpa_semantic_model(
    dataset="CustomBPA",
    lakehouse="YourLakehouseName",
    lakehouse_workspace="YourWorkspaceID"
    )

     

     

    Use the `create_report_from_reportjson()` function from Sempy_Labs to load custom rules into your BPA

     

    sl.report.create_report_from_reportjson(
    report="CustomBPAReport",
    dataset="CustomBPA",
    report_json="path/to/your/rules.json"
    )

     

     

    https://semantic-link-labs.readthedocs.io/en/stable/sempy_labs.html

     


    please accept the answer and give kudos if this is helpful 

  • v-karpurapud's avatar
    1 year ago

    Hi falguni 


    Thank you for reaching out to the Microsoft Fabric community. We understand your need for a custom Best Practice Analyzer (BPA) to enforce specific best practices.

     

    • When implementing a custom BPA, challenges may include defining custom rules, ensuring they are correctly structured and applied, and retrieving relevant datasets for validation. Custom BPA rules should include Rule ID, Name & Description, Condition, and Severity Level.

     

    • Once the rules are defined, the BPA Analyzer will load them, retrieve datasets/reports from Microsoft Fabric, apply rule conditions to check compliance, and generate a summary report.

     

    • To ensure successful execution, verify that rules are in the correct format, data source connectivity is established, and the analyzer execution is properly triggered.Once the BPA runs, results should be logged and reported for analysis.

     

    Please refer to the following Microsoft documentation for further details:

    Run Best Practices Analyzer Scans and Manage Scan Results_1 | Microsoft Learn

     

    If my response has resolved your query, please mark it as the Accepted Solution to help others. Additionally, I would appreciate a 'Kudos' if you found my response helpful. 

    A special thanks to nilendraFabric for you prompt response.

     

    Thank you!