1818from datapilot .core .platforms .dbt .formatting import generate_project_insights_table
1919from datapilot .core .platforms .dbt .utils import load_catalog
2020from datapilot .core .platforms .dbt .utils import load_manifest
21+ from datapilot .core .platforms .dbt .utils import load_run_results
22+ from datapilot .core .platforms .dbt .utils import load_sources
2123from datapilot .utils .formatting .utils import tabulate_data
2224from datapilot .utils .utils import map_url_to_instance
2325
@@ -155,6 +157,9 @@ def project_health(
155157)
156158@click .option ("--manifest-path" , required = True , prompt = "Manifest Path" , help = "Path to the manifest file." )
157159@click .option ("--catalog-path" , required = False , prompt = False , help = "Path to the catalog file." )
160+ @click .option ("--run-results-path" , required = False , prompt = False , help = "Path to the run_results.json file." )
161+ @click .option ("--sources-path" , required = False , prompt = False , help = "Path to the sources.json file (source freshness results)." )
162+ @click .option ("--semantic-manifest-path" , required = False , prompt = False , help = "Path to the semantic_manifest.json file." )
158163def onboard (
159164 token ,
160165 instance_name ,
@@ -164,6 +169,9 @@ def onboard(
164169 dbt_integration_environment ,
165170 manifest_path ,
166171 catalog_path ,
172+ run_results_path ,
173+ sources_path ,
174+ semantic_manifest_path ,
167175):
168176 """Onboard a manifest file to DBT. You can specify either --dbt_integration_id or --dbt_integration_name."""
169177
@@ -198,34 +206,91 @@ def onboard(
198206 elif dbt_integration_name and dbt_integration_id :
199207 click .echo ("Warning: Both integration ID and name provided. Using ID and ignoring name." )
200208
209+ # Validate manifest (required)
201210 try :
202211 load_manifest (manifest_path )
203212 except Exception as e :
204213 click .echo (f"Error: { e } " )
205214 return
206215
216+ # Validate optional artifacts if provided
217+ if catalog_path :
218+ try :
219+ load_catalog (catalog_path )
220+ except Exception as e :
221+ click .echo (f"Error validating catalog: { e } " )
222+ return
223+
224+ if run_results_path :
225+ try :
226+ load_run_results (run_results_path )
227+ except Exception as e :
228+ click .echo (f"Error validating run_results: { e } " )
229+ return
230+
231+ if sources_path :
232+ try :
233+ load_sources (sources_path )
234+ except Exception as e :
235+ click .echo (f"Error validating sources: { e } " )
236+ return
237+
238+ # Onboard manifest (required)
207239 response = onboard_file (token , instance_name , dbt_integration_id , dbt_integration_environment , "manifest" , manifest_path , backend_url )
208240 if response ["ok" ]:
209241 click .echo ("Manifest onboarded successfully!" )
210242 else :
211243 click .echo (f"{ response ['message' ]} " )
212-
213- if not catalog_path :
214244 return
215245
216- response = onboard_file (token , instance_name , dbt_integration_id , dbt_integration_environment , "catalog" , catalog_path , backend_url )
217- if response ["ok" ]:
218- click .echo ("Catalog onboarded successfully!" )
219- else :
220- click .echo (f"{ response ['message' ]} " )
246+ # Onboard optional artifacts
247+ artifacts_uploaded = ["manifest" ]
248+
249+ if catalog_path :
250+ response = onboard_file (token , instance_name , dbt_integration_id , dbt_integration_environment , "catalog" , catalog_path , backend_url )
251+ if response ["ok" ]:
252+ click .echo ("Catalog onboarded successfully!" )
253+ artifacts_uploaded .append ("catalog" )
254+ else :
255+ click .echo (f"{ response ['message' ]} " )
256+
257+ if run_results_path :
258+ response = onboard_file (
259+ token , instance_name , dbt_integration_id , dbt_integration_environment , "run_results" , run_results_path , backend_url
260+ )
261+ if response ["ok" ]:
262+ click .echo ("Run results onboarded successfully!" )
263+ artifacts_uploaded .append ("run_results" )
264+ else :
265+ click .echo (f"{ response ['message' ]} " )
266+
267+ if sources_path :
268+ response = onboard_file (token , instance_name , dbt_integration_id , dbt_integration_environment , "sources" , sources_path , backend_url )
269+ if response ["ok" ]:
270+ click .echo ("Sources onboarded successfully!" )
271+ artifacts_uploaded .append ("sources" )
272+ else :
273+ click .echo (f"{ response ['message' ]} " )
274+
275+ if semantic_manifest_path :
276+ response = onboard_file (
277+ token , instance_name , dbt_integration_id , dbt_integration_environment , "semantic_manifest" , semantic_manifest_path , backend_url
278+ )
279+ if response ["ok" ]:
280+ click .echo ("Semantic manifest onboarded successfully!" )
281+ artifacts_uploaded .append ("semantic_manifest" )
282+ else :
283+ click .echo (f"{ response ['message' ]} " )
221284
285+ # Start ingestion
222286 response = start_dbt_ingestion (token , instance_name , dbt_integration_id , dbt_integration_environment , backend_url )
223287 if response ["ok" ]:
224288 url = map_url_to_instance (backend_url , instance_name )
289+ artifacts_str = ", " .join (artifacts_uploaded )
225290 if not url :
226- click .echo ("Manifest and catalog ingestion has started. " )
291+ click .echo (f"Ingestion has started for: { artifacts_str } " )
227292 else :
228293 url = f"{ url } /settings/integrations/{ dbt_integration_id } /{ dbt_integration_environment } "
229- click .echo (f"Manifest and catalog ingestion has started. You can check the status at { url } " )
294+ click .echo (f"Ingestion has started for: { artifacts_str } . You can check the status at { url } " )
230295 else :
231296 click .echo (f"{ response ['message' ]} " )
0 commit comments