From 4c9ef97d9dc9f9f7b0446c38a7f64b0f00ff5b49 Mon Sep 17 00:00:00 2001 From: surya <118222278+suryaiyer95@users.noreply.github.com> Date: Fri, 31 May 2024 16:35:19 -0700 Subject: [PATCH] feat: fix URLS (#38) * fix: url * fix urls * fix: url * fix: url --- src/datapilot/core/platforms/dbt/cli/cli.py | 8 +++++++- src/datapilot/utils/utils.py | 15 +++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/datapilot/core/platforms/dbt/cli/cli.py b/src/datapilot/core/platforms/dbt/cli/cli.py index acb8ebab..12e1bc4b 100644 --- a/src/datapilot/core/platforms/dbt/cli/cli.py +++ b/src/datapilot/core/platforms/dbt/cli/cli.py @@ -15,6 +15,7 @@ from datapilot.core.platforms.dbt.utils import load_catalog from datapilot.core.platforms.dbt.utils import load_manifest from datapilot.utils.formatting.utils import tabulate_data +from datapilot.utils.utils import map_url_to_instance logging.basicConfig(level=logging.INFO) @@ -138,6 +139,11 @@ def onboard( response = start_dbt_ingestion(token, instance_name, dbt_core_integration_id, dbt_core_integration_environment, backend_url) if response["ok"]: - click.echo("Onboarding completed successfully!") + url = map_url_to_instance(backend_url, instance_name) + if not url: + click.echo("Manifest and catalog ingestion has started.") + else: + url = f"{url}/settings/integrations/{dbt_core_integration_id}/{dbt_core_integration_environment}" + click.echo(f"Manifest and catalog ingestion has started. You can check the status at {url}") else: click.echo(f"{response['message']}") diff --git a/src/datapilot/utils/utils.py b/src/datapilot/utils/utils.py index ffd83388..feb0cb7e 100644 --- a/src/datapilot/utils/utils.py +++ b/src/datapilot/utils/utils.py @@ -311,7 +311,14 @@ def generate_partial_manifest_catalog(changed_files, base_path: str = "./"): raise Exception("Unable to generate partial manifest and catalog") from e -if __name__ == "__main__": - print("Running main") - print(generate_partial_manifest_catalog([], "/Users/gaurp/Desktop/manifest.json", "")) - print("Done running main") +def map_url_to_instance(url, instance): + # Base URLs and their corresponding patterns + url_mapping = { + "https://api.tryaltimate.com": f"https://{instance}.demo.tryaltimate.com", + "https://api.myaltimate.com": f"https://{instance}.app.myaltimate.com", + "https://api.getaltimate.com": f"https://{instance}.app.getaltimate.com", + "http://localhost:8000": f"http://{instance}.localhost:3000", + } + + # Check if the URL is in the dictionary and return the corresponding instance URL + return url_mapping.get(url)