From a2fc02294c71ef7a656a7565eb658c383961af8e Mon Sep 17 00:00:00 2001 From: Mayuri Nehate <33225191+mayurinehate@users.noreply.github.com> Date: Wed, 12 Jul 2023 17:11:33 +0530 Subject: [PATCH] fix(ingest/snowflake): fix azure cloud region ids in external url (#8376) Co-authored-by: Harshal Sheth --- .../ingestion/source/snowflake/constants.py | 17 +++++++++++++++-- .../tests/unit/test_snowflake_source.py | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/metadata-ingestion/src/datahub/ingestion/source/snowflake/constants.py b/metadata-ingestion/src/datahub/ingestion/source/snowflake/constants.py index 05f526a060..6f5e22e39d 100644 --- a/metadata-ingestion/src/datahub/ingestion/source/snowflake/constants.py +++ b/metadata-ingestion/src/datahub/ingestion/source/snowflake/constants.py @@ -17,12 +17,25 @@ class SnowflakeEdition(str, Enum): ENTERPRISE = "Enterprise or above" -# See https://docs.snowflake.com/en/user-guide/admin-account-identifier.html#region-ids +# See https://docs.snowflake.com/en/user-guide/admin-account-identifier#non-vps-account-locator-formats-by-cloud-platform-and-region # Includes only exceptions to format _ SNOWFLAKE_REGION_CLOUD_REGION_MAPPING = { "aws_us_east_1_gov": (SnowflakeCloudProvider.AWS, "us-east-1"), + "azure_westus2": (SnowflakeCloudProvider.AZURE, "west-us-2"), + "azure_centralus": (SnowflakeCloudProvider.AZURE, "central-us"), + "azure_southcentralus": (SnowflakeCloudProvider.AZURE, "south-central-us"), + "azure_eastus2": (SnowflakeCloudProvider.AZURE, "east-us-2"), + "azure_usgovvirginia": (SnowflakeCloudProvider.AZURE, "us-gov-virginia"), + "azure_canadacentral": (SnowflakeCloudProvider.AZURE, "canada-central"), "azure_uksouth": (SnowflakeCloudProvider.AZURE, "uk-south"), - "azure_centralindia": (SnowflakeCloudProvider.AZURE, "central-india.azure"), + "azure_northeurope": (SnowflakeCloudProvider.AZURE, "north-europe"), + "azure_westeurope": (SnowflakeCloudProvider.AZURE, "west-europe"), + "azure_switzerlandnorth": (SnowflakeCloudProvider.AZURE, "switzerland-north"), + "azure_uaenorth": (SnowflakeCloudProvider.AZURE, "uae-north"), + "azure_centralindia": (SnowflakeCloudProvider.AZURE, "central-india"), + "azure_japaneast": (SnowflakeCloudProvider.AZURE, "japan-east"), + "azure_southeastasia": (SnowflakeCloudProvider.AZURE, "southeast-asia"), + "azure_australiaeast": (SnowflakeCloudProvider.AZURE, "australia-east"), } # https://docs.snowflake.com/en/sql-reference/snowflake-db.html diff --git a/metadata-ingestion/tests/unit/test_snowflake_source.py b/metadata-ingestion/tests/unit/test_snowflake_source.py index 66f25b83cf..1c26ca2487 100644 --- a/metadata-ingestion/tests/unit/test_snowflake_source.py +++ b/metadata-ingestion/tests/unit/test_snowflake_source.py @@ -593,7 +593,7 @@ def test_azure_cloud_region_from_snowflake_region_id(): ) assert cloud == SnowflakeCloudProvider.AZURE - assert cloud_region_id == "switzerlandnorth" + assert cloud_region_id == "switzerland-north" ( cloud, @@ -603,7 +603,7 @@ def test_azure_cloud_region_from_snowflake_region_id(): ) assert cloud == SnowflakeCloudProvider.AZURE - assert cloud_region_id == "central-india.azure" + assert cloud_region_id == "central-india" def test_unknown_cloud_region_from_snowflake_region_id():