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_semantic_manifest
23+ from datapilot .core .platforms .dbt .utils import load_sources
2124from datapilot .utils .formatting .utils import tabulate_data
2225from datapilot .utils .utils import map_url_to_instance
2326
@@ -155,6 +158,9 @@ def project_health(
155158)
156159@click .option ("--manifest-path" , required = True , prompt = "Manifest Path" , help = "Path to the manifest file." )
157160@click .option ("--catalog-path" , required = False , prompt = False , help = "Path to the catalog file." )
161+ @click .option ("--run-results-path" , required = False , prompt = False , help = "Path to the run_results.json file." )
162+ @click .option ("--sources-path" , required = False , prompt = False , help = "Path to the sources.json file (source freshness results)." )
163+ @click .option ("--semantic-manifest-path" , required = False , prompt = False , help = "Path to the semantic_manifest.json file." )
158164def onboard (
159165 token ,
160166 instance_name ,
@@ -164,6 +170,9 @@ def onboard(
164170 dbt_integration_environment ,
165171 manifest_path ,
166172 catalog_path ,
173+ run_results_path ,
174+ sources_path ,
175+ semantic_manifest_path ,
167176):
168177 """Onboard a manifest file to DBT. You can specify either --dbt_integration_id or --dbt_integration_name."""
169178
@@ -198,34 +207,98 @@ def onboard(
198207 elif dbt_integration_name and dbt_integration_id :
199208 click .echo ("Warning: Both integration ID and name provided. Using ID and ignoring name." )
200209
210+ # Validate manifest (required)
201211 try :
202212 load_manifest (manifest_path )
203213 except Exception as e :
204214 click .echo (f"Error: { e } " )
205215 return
206216
217+ # Validate optional artifacts if provided
218+ if catalog_path :
219+ try :
220+ load_catalog (catalog_path )
221+ except Exception as e :
222+ click .echo (f"Error validating catalog: { e } " )
223+ return
224+
225+ if run_results_path :
226+ try :
227+ load_run_results (run_results_path )
228+ except Exception as e :
229+ click .echo (f"Error validating run_results: { e } " )
230+ return
231+
232+ if sources_path :
233+ try :
234+ load_sources (sources_path )
235+ except Exception as e :
236+ click .echo (f"Error validating sources: { e } " )
237+ return
238+
239+ if semantic_manifest_path :
240+ try :
241+ load_semantic_manifest (semantic_manifest_path )
242+ except Exception as e :
243+ click .echo (f"Error validating semantic_manifest: { e } " )
244+ return
245+
246+ # Onboard manifest (required)
207247 response = onboard_file (token , instance_name , dbt_integration_id , dbt_integration_environment , "manifest" , manifest_path , backend_url )
208248 if response ["ok" ]:
209249 click .echo ("Manifest onboarded successfully!" )
210250 else :
211251 click .echo (f"{ response ['message' ]} " )
212-
213- if not catalog_path :
214252 return
215253
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' ]} " )
254+ # Onboard optional artifacts
255+ artifacts_uploaded = ["manifest" ]
256+
257+ if catalog_path :
258+ response = onboard_file (token , instance_name , dbt_integration_id , dbt_integration_environment , "catalog" , catalog_path , backend_url )
259+ if response ["ok" ]:
260+ click .echo ("Catalog onboarded successfully!" )
261+ artifacts_uploaded .append ("catalog" )
262+ else :
263+ click .echo (f"{ response ['message' ]} " )
264+
265+ if run_results_path :
266+ response = onboard_file (
267+ token , instance_name , dbt_integration_id , dbt_integration_environment , "run_results" , run_results_path , backend_url
268+ )
269+ if response ["ok" ]:
270+ click .echo ("Run results onboarded successfully!" )
271+ artifacts_uploaded .append ("run_results" )
272+ else :
273+ click .echo (f"{ response ['message' ]} " )
274+
275+ if sources_path :
276+ response = onboard_file (token , instance_name , dbt_integration_id , dbt_integration_environment , "sources" , sources_path , backend_url )
277+ if response ["ok" ]:
278+ click .echo ("Sources onboarded successfully!" )
279+ artifacts_uploaded .append ("sources" )
280+ else :
281+ click .echo (f"{ response ['message' ]} " )
282+
283+ if semantic_manifest_path :
284+ response = onboard_file (
285+ token , instance_name , dbt_integration_id , dbt_integration_environment , "semantic_manifest" , semantic_manifest_path , backend_url
286+ )
287+ if response ["ok" ]:
288+ click .echo ("Semantic manifest onboarded successfully!" )
289+ artifacts_uploaded .append ("semantic_manifest" )
290+ else :
291+ click .echo (f"{ response ['message' ]} " )
221292
293+ # Start ingestion
222294 response = start_dbt_ingestion (token , instance_name , dbt_integration_id , dbt_integration_environment , backend_url )
223295 if response ["ok" ]:
224296 url = map_url_to_instance (backend_url , instance_name )
297+ artifacts_str = ", " .join (artifacts_uploaded )
225298 if not url :
226- click .echo ("Manifest and catalog ingestion has started. " )
299+ click .echo (f"Ingestion has started for: { artifacts_str } " )
227300 else :
228301 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 } " )
302+ click .echo (f"Ingestion has started for: { artifacts_str } . You can check the status at { url } " )
230303 else :
231304 click .echo (f"{ response ['message' ]} " )
0 commit comments