33import click
44
55from datapilot .clients .altimate .utils import check_token_and_instance
6+ from datapilot .clients .altimate .utils import get_all_dbt_configs
67from datapilot .clients .altimate .utils import onboard_file
78from datapilot .clients .altimate .utils import start_dbt_ingestion
89from datapilot .clients .altimate .utils import validate_credentials
@@ -45,6 +46,11 @@ def dbt():
4546 required = False ,
4647 help = "Path to the DBT config file" ,
4748)
49+ @click .option (
50+ "--config-name" ,
51+ required = False ,
52+ help = "Name of the DBT config to use from the API" ,
53+ )
4854@click .option (
4955 "--select" ,
5056 required = False ,
@@ -53,7 +59,14 @@ def dbt():
5359)
5460@click .option ("--backend-url" , required = False , help = "Altimate's Backend URL" , default = "https://api.myaltimate.com" )
5561def project_health (
56- token , instance_name , manifest_path , catalog_path , config_path = None , select = None , backend_url = "https://api.myaltimate.com"
62+ token ,
63+ instance_name ,
64+ manifest_path ,
65+ catalog_path ,
66+ config_path = None ,
67+ config_name = None ,
68+ select = None ,
69+ backend_url = "https://api.myaltimate.com" ,
5770):
5871 """
5972 Validate the DBT project's configuration and structure.
@@ -62,6 +75,22 @@ def project_health(
6275 config = None
6376 if config_path :
6477 config = load_config (config_path )
78+ elif config_name and token and instance_name :
79+ # Get configs from API
80+ configs = get_all_dbt_configs (token , instance_name , backend_url )
81+ if configs and "items" in configs :
82+ # Find config by name
83+ matching_configs = [c for c in configs ["items" ] if c ["name" ] == config_name ]
84+ if matching_configs :
85+ # Get the config directly from the API response
86+ config = matching_configs [0 ].get ("config" , {})
87+ else :
88+ click .echo (f"No config found with name: { config_name } " )
89+ return
90+ else :
91+ click .echo ("Failed to fetch configs from API" )
92+ return
93+
6594 selected_models = []
6695 if select :
6796 selected_models = select .split (" " )
0 commit comments