pypaginate.adapters.sqlalchemy.columns

Column resolution for SQLAlchemy queries.

Extracts mapped columns from ORM entities referenced in a SQLAlchemy Select statement, used by filters, sorting, and search.

Functions

resolve_column(→ Any)

Resolve a field name to a SQLAlchemy column attribute.

Module Contents

pypaginate.adapters.sqlalchemy.columns.resolve_column(query: sqlalchemy.sql.Select[Any], field: str) Any

Resolve a field name to a SQLAlchemy column attribute.

Inspects the query’s column_descriptions to find the ORM entity, then resolves the field via getattr.

Parameters:
  • query – A SQLAlchemy Select statement.

  • field – Dotted or simple field name (e.g., "name").

Returns:

The column attribute for use in WHERE/ORDER BY clauses.

Raises:

ConfigurationError – If no entity found or field does not exist.