sqlmeta.objects.extension

Extension SQL model class (PostgreSQL-specific).

Classes

Extension(name[, version, schema, ...])

Represents a database extension (PostgreSQL-specific).

class sqlmeta.objects.extension.Extension(name: str, version: str | None = None, schema: str | None = None, description: str | None = None, relocatable: bool = False, dialect: str | None = None)[source]

Represents a database extension (PostgreSQL-specific).

Extensions are add-on modules that provide additional functionality to the database, such as PostGIS for geographic data, pgcrypto for cryptographic functions, or pg_trgm for trigram text search.

__init__(name: str, version: str | None = None, schema: str | None = None, description: str | None = None, relocatable: bool = False, dialect: str | None = None)[source]

Initialize an extension.

Parameters:
  • name – Extension name

  • version – Extension version (optional)

  • schema – Schema where the extension is installed (optional)

  • description – Extension description (optional)

  • relocatable – Whether the extension can be relocated to another schema

  • dialect – SQL dialect (typically ‘postgresql’)

property create_statement: str

Generate CREATE EXTENSION statement.

Returns:

PostgreSQL CREATE EXTENSION statement

property drop_statement: str

Generate DROP EXTENSION statement.

Returns:

PostgreSQL DROP EXTENSION statement

__str__() str[source]

Return string representation of the extension.

__eq__(other: Any) bool[source]

Check if two extensions are equal.

__hash__() int[source]

Return hash of the extension.