MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / __init__

Method __init__

lib/sqlalchemy/sql/elements.py:2775–2795  ·  view source on GitHub ↗

Construct a :class:`_expression.TString` from a Python 3.14+ template string. :param template: a Python 3.14+ template string (t-string) that contains SQL fragments and Python expressions to be interpolated.

(self, template: Template)

Source from the content-addressed store, hash-verified

2773 )
2774
2775 def __init__(self, template: Template):
2776 """Construct a :class:`_expression.TString` from a Python 3.14+
2777 template string.
2778
2779 :param template: a Python 3.14+ template string (t-string) that
2780 contains SQL fragments and Python expressions to be interpolated.
2781
2782 """
2783 self.parts: List[ClauseElement] = []
2784
2785 if not isinstance(template, Template):
2786 raise exc.ArgumentError("pep-750 Tstring (e.g. t'...') expected")
2787
2788 for part in template:
2789 if isinstance(part, str):
2790 self.parts.append(TextClause(part))
2791 else:
2792 assert hasattr(part, "value")
2793 self.parts.append(
2794 coercions.expect(roles.TStringElementRole, part.value)
2795 )
2796
2797 def bindparams(
2798 self,

Callers

nothing calls this directly

Calls 2

TextClauseClass · 0.85
appendMethod · 0.45

Tested by

no test coverage detected