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_features={"enable_pgvector": True} enables extension detection and
promotes the runtime dialect to pgvector when the PostgreSQL vector
extension is installed. It does not register automatic psqlpy vector type
handlers; pass psqlpy.extra_types.PgVector values or use explicit SQL casts
for vector parameters.
Driver¶
Data Dictionary¶
- class sqlspec.adapters.psqlpy.data_dictionary.PsqlpyDataDictionary[source]¶
Bases:
AsyncDataDictionaryBasePostgreSQL-specific async data dictionary via psqlpy.
- dialect: ClassVar[str] = 'postgres'¶
Dialect identifier. Must be defined by subclasses as a class attribute.
- 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:
- async get_optimal_type(driver, type_category)[source]¶
Get optimal PostgreSQL type for a category.
- Return type:
- 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]