Represents a ``SELECT`` statement. The :class:`_sql.Select` object is normally constructed using the :func:`_sql.select` function. See that function for details. Available extension points: * ``post_select``: applies additional logic after the ``SELECT`` keyword. * ``pre_colu
| 5447 | |
| 5448 | |
| 5449 | class Select( |
| 5450 | HasPrefixes, |
| 5451 | HasSuffixes, |
| 5452 | HasHints, |
| 5453 | HasCompileState, |
| 5454 | HasSyntaxExtensions[ |
| 5455 | Literal["post_select", "pre_columns", "post_criteria", "post_body"] |
| 5456 | ], |
| 5457 | _SelectFromElements, |
| 5458 | GenerativeSelect, |
| 5459 | TypedReturnsRows[Unpack[_Ts]], |
| 5460 | ): |
| 5461 | """Represents a ``SELECT`` statement. |
| 5462 | |
| 5463 | The :class:`_sql.Select` object is normally constructed using the |
| 5464 | :func:`_sql.select` function. See that function for details. |
| 5465 | |
| 5466 | Available extension points: |
| 5467 | |
| 5468 | * ``post_select``: applies additional logic after the ``SELECT`` keyword. |
| 5469 | * ``pre_columns``: applies additional logic between the ``DISTINCT`` |
| 5470 | keyword (if any) and the list of columns. |
| 5471 | * ``post_criteria``: applies additional logic after the ``HAVING`` clause. |
| 5472 | * ``post_body``: applies additional logic after the ``FOR UPDATE`` clause. |
| 5473 | |
| 5474 | .. seealso:: |
| 5475 | |
| 5476 | :func:`_sql.select` |
| 5477 | |
| 5478 | :ref:`tutorial_selecting_data` - in the 2.0 tutorial |
| 5479 | |
| 5480 | """ |
| 5481 | |
| 5482 | __visit_name__ = "select" |
| 5483 | |
| 5484 | _setup_joins: Tuple[_SetupJoinsElement, ...] = () |
| 5485 | _memoized_select_entities: Tuple[TODO_Any, ...] = () |
| 5486 | |
| 5487 | _raw_columns: List[_ColumnsClauseElement] |
| 5488 | |
| 5489 | _distinct: bool = False |
| 5490 | _distinct_on: Tuple[ColumnElement[Any], ...] = () |
| 5491 | _correlate: Tuple[FromClause, ...] = () |
| 5492 | _correlate_except: Optional[Tuple[FromClause, ...]] = None |
| 5493 | _where_criteria: Tuple[ColumnElement[Any], ...] = () |
| 5494 | _having_criteria: Tuple[ColumnElement[Any], ...] = () |
| 5495 | _from_obj: Tuple[FromClause, ...] = () |
| 5496 | |
| 5497 | _position_map = util.immutabledict( |
| 5498 | { |
| 5499 | "post_select": "_post_select_clause", |
| 5500 | "pre_columns": "_pre_columns_clause", |
| 5501 | "post_criteria": "_post_criteria_clause", |
| 5502 | "post_body": "_post_body_clause", |
| 5503 | } |
| 5504 | ) |
| 5505 | |
| 5506 | _post_select_clause: Optional[ClauseElement] = None |