33import click
44
55from datapilot .clients .altimate .utils import check_token_and_instance
6+ from datapilot .clients .altimate .utils import get_project_governance_llm_checks
67from datapilot .clients .altimate .utils import onboard_file
8+ from datapilot .clients .altimate .utils import run_project_governance_llm_checks
79from datapilot .clients .altimate .utils import start_dbt_ingestion
810from datapilot .clients .altimate .utils import validate_credentials
911from datapilot .clients .altimate .utils import validate_permissions
@@ -28,6 +30,8 @@ def dbt():
2830
2931
3032@dbt .command ("project-health" )
33+ @click .option ("--token" , prompt = "API Token" , help = "Your API token for authentication." )
34+ @click .option ("--instance-name" , prompt = "Instance Name" , help = "Your tenant ID." )
3135@click .option (
3236 "--manifest-path" ,
3337 required = True ,
@@ -49,7 +53,10 @@ def dbt():
4953 default = None ,
5054 help = "Selective model testing. Specify one or more models to run tests on." ,
5155)
52- def project_health (manifest_path , catalog_path , config_path = None , select = None ):
56+ @click .option ("--backend-url" , required = False , help = "Altimate's Backend URL" , default = "https://api.myaltimate.com" )
57+ def project_health (
58+ token , instance_name , manifest_path , catalog_path , config_path = None , select = None , backend_url = "https://api.myaltimate.com"
59+ ):
5360 """
5461 Validate the DBT project's configuration and structure.
5562 :param manifest_path: Path to the DBT manifest file.
@@ -62,6 +69,11 @@ def project_health(manifest_path, catalog_path, config_path=None, select=None):
6269 selected_models = select .split (" " )
6370 manifest = load_manifest (manifest_path )
6471 catalog = load_catalog (catalog_path ) if catalog_path else None
72+
73+ llm_checks = get_project_governance_llm_checks (token , instance_name , backend_url )
74+ check_names = [check ["name" ] for check in llm_checks if check ["alias" ] not in config .get ("disabled_insights" , [])]
75+ llm_check_results = run_project_governance_llm_checks (token , instance_name , backend_url , manifest , catalog , check_names )
76+
6577 insight_generator = DBTInsightGenerator (manifest = manifest , catalog = catalog , config = config , selected_models = selected_models )
6678 reports = insight_generator .run ()
6779
@@ -85,6 +97,19 @@ def project_health(manifest_path, catalog_path, config_path=None, select=None):
8597 click .echo ("--" * 50 )
8698 click .echo (tabulate_data (project_report , headers = "keys" ))
8799
100+ if llm_check_results :
101+ click .echo ("--" * 50 )
102+ click .echo ("Project Governance LLM Insights" )
103+ click .echo ("--" * 50 )
104+ for check in llm_check_results ["results" ]:
105+ click .echo (f"Check: { check ['name' ]} " )
106+ for answer in check ["answer" ]:
107+ click .echo (f"Rule: { answer ['Rule' ]} " )
108+ click .echo (f"Location: { answer ['Location' ]} " )
109+ click .echo (f"Issue: { answer ['Issue' ]} " )
110+ click .echo (f"Fix: { answer ['Fix' ]} " )
111+ click .echo ("\n " )
112+
88113
89114@dbt .command ("onboard" )
90115@click .option ("--token" , prompt = "API Token" , help = "Your API token for authentication." )
0 commit comments