(
self,
label,
add_to_result_map=None,
within_label_clause=False,
within_columns_clause=False,
render_label_as_label=None,
result_map_targets=(),
**kw,
)
| 2552 | ) |
| 2553 | |
| 2554 | def visit_label( |
| 2555 | self, |
| 2556 | label, |
| 2557 | add_to_result_map=None, |
| 2558 | within_label_clause=False, |
| 2559 | within_columns_clause=False, |
| 2560 | render_label_as_label=None, |
| 2561 | result_map_targets=(), |
| 2562 | **kw, |
| 2563 | ): |
| 2564 | # only render labels within the columns clause |
| 2565 | # or ORDER BY clause of a select. dialect-specific compilers |
| 2566 | # can modify this behavior. |
| 2567 | render_label_with_as = ( |
| 2568 | within_columns_clause and not within_label_clause |
| 2569 | ) |
| 2570 | render_label_only = render_label_as_label is label |
| 2571 | |
| 2572 | if render_label_only or render_label_with_as: |
| 2573 | if isinstance(label.name, elements._truncated_label): |
| 2574 | labelname = self._truncated_identifier("colident", label.name) |
| 2575 | else: |
| 2576 | labelname = label.name |
| 2577 | |
| 2578 | if render_label_with_as: |
| 2579 | if add_to_result_map is not None: |
| 2580 | add_to_result_map( |
| 2581 | labelname, |
| 2582 | label.name, |
| 2583 | (label, labelname) + label._alt_names + result_map_targets, |
| 2584 | label.type, |
| 2585 | ) |
| 2586 | return ( |
| 2587 | label.element._compiler_dispatch( |
| 2588 | self, |
| 2589 | within_columns_clause=True, |
| 2590 | within_label_clause=True, |
| 2591 | **kw, |
| 2592 | ) |
| 2593 | + OPERATORS[operators.as_] |
| 2594 | + self.preparer.format_label(label, labelname) |
| 2595 | ) |
| 2596 | elif render_label_only: |
| 2597 | return self.preparer.format_label(label, labelname) |
| 2598 | else: |
| 2599 | return label.element._compiler_dispatch( |
| 2600 | self, within_columns_clause=False, **kw |
| 2601 | ) |
| 2602 | |
| 2603 | def _fallback_column_name(self, column): |
| 2604 | raise exc.CompileError( |
nothing calls this directly
no test coverage detected