sqlmeta.objects.foreign_data_wrapper

Foreign Data Wrapper SQL model class (PostgreSQL-specific).

Classes

ForeignDataWrapper(name[, handler, ...])

Represents a foreign data wrapper (PostgreSQL-specific).

class sqlmeta.objects.foreign_data_wrapper.ForeignDataWrapper(name: str, handler: str | None = None, validator: str | None = None, options: Dict[str, str] | None = None, schema: str | None = None, dialect: str | None = None)[source]

Represents a foreign data wrapper (PostgreSQL-specific).

Foreign Data Wrappers (FDW) enable PostgreSQL to access external data sources including other databases (postgres_fdw, oracle_fdw), files (file_fdw), and custom data sources.

__init__(name: str, handler: str | None = None, validator: str | None = None, options: Dict[str, str] | None = None, schema: str | None = None, dialect: str | None = None)[source]

Initialize a foreign data wrapper.

Parameters:
  • name – FDW name (e.g., ‘postgres_fdw’, ‘oracle_fdw’)

  • handler – Handler function name (optional)

  • validator – Validator function name (optional)

  • options – FDW-specific options as key-value pairs (optional)

  • schema – Schema (typically ‘public’ or system schemas)

  • dialect – SQL dialect (typically ‘postgresql’)

property create_statement: str

Generate CREATE FOREIGN DATA WRAPPER statement.

Returns:

PostgreSQL CREATE FOREIGN DATA WRAPPER statement

property drop_statement: str

Generate DROP FOREIGN DATA WRAPPER statement.

Returns:

PostgreSQL DROP FOREIGN DATA WRAPPER statement

__str__() str[source]

Return string representation of the FDW.

__eq__(other: Any) bool[source]

Check if two FDWs are equal.

__hash__() int[source]

Return hash of the FDW.