33import click
44
55from datapilot .clients .altimate .utils import check_token_and_instance
6- from datapilot .clients .altimate .utils import onboard_manifest
6+ from datapilot .clients .altimate .utils import onboard_file
7+ from datapilot .clients .altimate .utils import start_dbt_ingestion
78from datapilot .clients .altimate .utils import validate_credentials
89from datapilot .config .config import load_config
910from datapilot .core .platforms .dbt .constants import MODEL
@@ -87,9 +88,21 @@ def project_health(manifest_path, catalog_path, config_path=None, select=None):
8788@click .option ("--token" , prompt = "API Token" , help = "Your API token for authentication." )
8889@click .option ("--instance-name" , prompt = "Instance Name" , help = "Your tenant ID." )
8990@click .option ("--dbt_core_integration_id" , prompt = "DBT Core Integration ID" , help = "DBT Core Integration ID" )
91+ @click .option (
92+ "--dbt_core_integration_environment" , default = "PROD" , prompt = "DBT Core Integration Environment" , help = "DBT Core Integration Environment"
93+ )
9094@click .option ("--manifest-path" , required = True , prompt = "Manifest Path" , help = "Path to the manifest file." )
95+ @click .option ("--catalog-path" , required = False , prompt = False , help = "Path to the catalog file." )
9196@click .option ("--backend-url" , required = False , help = "Altimate's Backend URL" , default = "https://api.myaltimate.com" )
92- def onboard (token , instance_name , dbt_core_integration_id , manifest_path , backend_url = "https://api.myaltimate.com" , env = None ):
97+ def onboard (
98+ token ,
99+ instance_name ,
100+ dbt_core_integration_id ,
101+ dbt_core_integration_environment ,
102+ manifest_path ,
103+ catalog_path ,
104+ backend_url = "https://api.myaltimate.com" ,
105+ ):
93106 """Onboard a manifest file to DBT."""
94107 check_token_and_instance (token , instance_name )
95108
@@ -104,9 +117,27 @@ def onboard(token, instance_name, dbt_core_integration_id, manifest_path, backen
104117 click .echo (f"Error: { e } " )
105118 return
106119
107- response = onboard_manifest (token , instance_name , dbt_core_integration_id , manifest_path , backend_url )
108-
120+ response = onboard_file (
121+ token , instance_name , dbt_core_integration_id , dbt_core_integration_environment , "manifest" , manifest_path , backend_url
122+ )
109123 if response ["ok" ]:
110124 click .echo ("Manifest onboarded successfully!" )
111125 else :
112126 click .echo (f"{ response ['message' ]} " )
127+
128+ if not catalog_path :
129+ return
130+
131+ response = onboard_file (
132+ token , instance_name , dbt_core_integration_id , dbt_core_integration_environment , "catalog" , catalog_path , backend_url
133+ )
134+ if response ["ok" ]:
135+ click .echo ("Catalog onboarded successfully!" )
136+ else :
137+ click .echo (f"{ response ['message' ]} " )
138+
139+ response = start_dbt_ingestion (token , instance_name , dbt_core_integration_id , dbt_core_integration_environment , backend_url )
140+ if response ["ok" ]:
141+ click .echo ("Onboarding completed successfully!" )
142+ else :
143+ click .echo (f"{ response ['message' ]} " )
0 commit comments