Class SchemaName


  • public class SchemaName
    extends Object
    Representation of a Snowflake schema name.

    A SchemaName object can be a representation of:

    • an individual schema identifier
    • a db.schema object

    Read more about schema names at Snowflake here.

    • Method Detail

      • fromString

        public static SchemaName fromString​(String schemaName)
        Creates a new schema name instance from the provided raw schema name.
        Parameters:
        schemaName - raw schema name
        Returns:
        new schema name instance
        Throws:
        InvalidObjectNameException - if the provided String is not a valid Snowflake schema name
      • from

        public static SchemaName from​(Identifier schema)
        Creates a new schema name instance from the provided schema identifier.
        Parameters:
        schema - schema identifier
        Returns:
        new schema name instance
        Throws:
        InvalidIdentifierException - if the provided schema identifier is null
      • from

        public static SchemaName from​(String database,
                                      String schema)
        Creates a new schema name instance from the provided raw database and schema identifiers.
        Parameters:
        database - raw database identifier
        schema - raw schema identifier
        Returns:
        new schema name instance
        Throws:
        InvalidIdentifierException - if the provided database or schema is not a valid Snowflake identifier
      • from

        public static SchemaName from​(Identifier database,
                                      Identifier schema)
        Creates a new schema name instance from the provided database and schema identifiers.
        Parameters:
        database - database identifier
        schema - schema identifier
        Returns:
        new schema name instance
        Throws:
        InvalidIdentifierException - if the provided schema identifier is null
      • isValid

        public static boolean isValid​(String schemaName)
        Returns whether the provided String is a valid schema name.
        Parameters:
        schemaName - raw schema name
        Returns:
        whether the provided String is a valid schema name
      • getValue

        public String getValue()
        Returns the schema name value.

        Returned value is ready to use in any SQL queries, no additional quoting or character escaping is required.

        The returned String can be a fully qualified name or a simple unqualified schema name.

        The individual identifiers will be converted to String using Identifier.getValue(). They may be quoted or unquoted.

        Returns:
        SQL-friendly object name
      • isFullyQualified

        public boolean isFullyQualified()
        Returns whether this schema name is fully qualified.
        Returns:
        whether this schema name is fully qualified
      • getDatabase

        public Optional<Identifier> getDatabase()
        Returns the database of this schema name.
        Returns:
        database of this schema name.
      • getSchema

        public Identifier getSchema()
        Returns the schema of this schema name.
        Returns:
        schema of this schema name.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object