PsqlPy

Async PostgreSQL adapter using psqlpy, a Rust-backed PostgreSQL driver with native connection pooling.

Configuration

Extension Dialects

PsqlPy supports the pgvector and ParadeDB dialects for vector similarity search and full-text search operators. See the Dialects reference for operator details.

Driver

Data Dictionary

class sqlspec.adapters.psqlpy.data_dictionary.PsqlpyDataDictionary[source]

Bases: AsyncDataDictionaryBase

PostgreSQL-specific async data dictionary via psqlpy.

dialect: ClassVar[str] = 'postgres'

Dialect identifier. Must be defined by subclasses as a class attribute.

__init__()[source]
async get_version(driver)[source]

Get PostgreSQL database version information.

Return type:

VersionInfo | None

async get_feature_flag(driver, feature)[source]

Check if PostgreSQL database supports a specific feature.

Return type:

bool

async get_optimal_type(driver, type_category)[source]

Get optimal PostgreSQL type for a category.

Return type:

str

async get_tables(driver, schema=None)[source]

Get tables sorted by topological dependency order using Recursive CTE.

Return type:

list[TableMetadata]

async get_columns(driver, table=None, schema=None)[source]

Get column information for a table or schema.

Return type:

list[ColumnMetadata]

async get_indexes(driver, table=None, schema=None)[source]

Get index metadata for a table or schema.

Return type:

list[IndexMetadata]

async get_foreign_keys(driver, table=None, schema=None)[source]

Get foreign key metadata.

Return type:

list[ForeignKeyMetadata]