sqlmeta.objects.user_defined_type

User-Defined Type SQL model class.

Classes

UserDefinedType(name, type_category[, ...])

Represents a user-defined type (UDT).

class sqlmeta.objects.user_defined_type.UserDefinedType(name: str, type_category: str, schema: str | None = None, data_type: str | None = None, definition: str | None = None, attributes: List[Dict[str, Any]] | None = None, enum_values: List[str] | None = None, base_type: str | None = None, comment: str | None = None, dialect: str | None = None)[source]

Represents a user-defined type (UDT).

__init__(name: str, type_category: str, schema: str | None = None, data_type: str | None = None, definition: str | None = None, attributes: List[Dict[str, Any]] | None = None, enum_values: List[str] | None = None, base_type: str | None = None, comment: str | None = None, dialect: str | None = None)[source]

Initialize a user-defined type.

Parameters:
  • name – Type name

  • type_category – Category of type (COMPOSITE, ENUM, DOMAIN, OBJECT, DISTINCT, etc.)

  • schema – Schema name (optional)

  • data_type – SQL data type classification (optional)

  • definition – Type definition/source code (optional)

  • attributes – List of attributes for composite/structured types (optional)

  • enum_values – List of values for enum types (optional)

  • base_type – Base type for DISTINCT types (optional)

  • comment – Type comment/description (optional)

  • dialect – SQL dialect

property is_composite: bool

Check if this is a composite/structured type.

property is_enum: bool

Check if this is an enum type.

property is_domain: bool

Check if this is a domain type.

property is_distinct: bool

Check if this is a distinct type.

property create_statement: str

Generate CREATE TYPE statement.

The syntax varies significantly by dialect and type category.

Returns:

Dialect-specific CREATE TYPE statement

property drop_statement: str

Generate DROP TYPE statement.

Returns:

Dialect-specific DROP TYPE statement

__str__() str[source]

Return string representation of the type.

__eq__(other: Any) bool[source]

Check if two types are equal.

__hash__() int[source]

Return hash of the type.