MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / foreign

Function foreign

lib/sqlalchemy/orm/relationships.py:230–247  ·  view source on GitHub ↗

Annotate a portion of a primaryjoin expression with a 'foreign' annotation. See the section :ref:`relationship_custom_foreign` for a description of use. .. seealso:: :ref:`relationship_custom_foreign` :func:`.remote`

(expr: _CEA)

Source from the content-addressed store, hash-verified

228
229
230def foreign(expr: _CEA) -> _CEA:
231 """Annotate a portion of a primaryjoin expression
232 with a 'foreign' annotation.
233
234 See the section :ref:`relationship_custom_foreign` for a
235 description of use.
236
237 .. seealso::
238
239 :ref:`relationship_custom_foreign`
240
241 :func:`.remote`
242
243 """
244
245 return _annotate_columns( # type: ignore
246 coercions.expect(roles.ColumnArgumentRole, expr), {"foreign": True}
247 )
248
249
250@dataclasses.dataclass

Calls 1

_annotate_columnsFunction · 0.85