Class SnowflakeUtils

java.lang.Object
io.openlineage.client.utils.SnowflakeUtils

public class SnowflakeUtils extends Object
  • Constructor Details

    • SnowflakeUtils

      public SnowflakeUtils()
  • Method Details

    • parseAccountIdentifier

      public static String parseAccountIdentifier(String sfFullURL)
      Parses the Snowflake full URL to extract the account identifier according to OpenLineage naming specification.

      Snowflake supports two URL formats:

      1. Organization-account format (preferred):

      • https://orgname-accountname.snowflakecomputing.com → orgname-accountname

      Note: Organization-account URLs never include region or cloud information.

      2. Legacy account locator format:

      • https://xy12345.snowflakecomputing.com → xy12345.us-west-1.aws (defaults added for AWS US West Oregon)
      • https://xy12345.us-east-1.snowflakecomputing.com → xy12345.us-east-1.aws (cloud defaults to aws)
      • https://xy12345.us-east-2.aws.snowflakecomputing.com → xy12345.us-east-2.aws
      • https://xy12345.east-us-2.azure.snowflakecomputing.com → xy12345.east-us-2.azure

      This method returns the namespace part for OpenLineage:

      • Organization-account format: snowflake://orgname-accountname
      • Account locator format: snowflake://account_locator.region.cloud
      Parameters:
      sfFullURL - The full Snowflake URL or account identifier
      Returns:
      The account identifier according to OpenLineage spec
    • stripQuotes

      public static String stripQuotes(String identifier)
      Strips surrounding double quotes from Snowflake identifiers if present.

      In Snowflake and other SQL databases, double quotes are used as delimiters to preserve case sensitivity or allow special characters in identifiers. The quotes are not part of the actual identifier name and should be removed for normalized dataset and column names.

      Examples:

      • "MyTable" → MyTable
      • "my_database" → my_database
      • normal_table → normal_table (no change)
      • "" → (empty string)
      • " → " (single quote, not stripped)
      Parameters:
      identifier - The identifier that may have surrounding quotes
      Returns:
      The identifier with surrounding quotes removed if present