Skip to content

yggdrasil.enums.jointype

jointype

Centralized join-type enum shared by tabular join surfaces.

Different engines spell the same join concept differently — pyarrow uses space-separated lower-case ("left anti", "left outer"), polars collapses to a single token ("left" / "anti"), SQL uppercases and appends JOIN ("LEFT ANTI JOIN"). Centralizing the canonical token set here lets a cross-engine surface accept any of those spellings and route through a single normalized member.

:class:JoinType provides:

  • canonical members for the nine join kinds the supported engines understand (inner, left/right/full outer, left/right semi, left/right anti, cross);
  • :meth:from_ for forgiving string / integer / :class:JoinType / None input with alias support ("left"LEFT_OUTER, "anti"LEFT_ANTI, "LEFT JOIN"LEFT_OUTER);
  • :meth:is_valid for boolean checks without raising;
  • :attr:arrow / :attr:polars / :attr:sql for engine-specific spellings, plus :attr:is_outer / :attr:is_semi / :attr:is_anti / :attr:is_inner / :attr:is_cross predicates.

Subclasses :class:IntEnum so members are stable, ordered, and serializable as integer codes — pass join_type.arrow to pa.Table.join and join_type.polars to pl.DataFrame.join.

JoinType

Bases: IntEnum

Canonical join kind for tabular join surfaces.

Use :meth:from_ when accepting external input — it canonicalizes aliases ("left", "LEFT JOIN", "anti", "outer", integer codes) to a member and raises :class:ValueError for unknown tokens.

Pass :attr:arrow / :attr:polars / :attr:sql to engine join APIs — pyarrow's :meth:pa.Table.join and polars' :meth:DataFrame.join accept different spellings of the same concept, and storing the integer code keeps the enum a clean discriminator without binding to either spelling.

arrow property

arrow: str

pyarrow's :meth:pa.Table.join join_type token.

polars property

polars: str

polars' :meth:DataFrame.join how token.

Polars has no built-in right semi / right anti form — those raise :class:NotImplementedError. Swap operands and use the left-side equivalent.

sql property

sql: str

SQL JOIN clause keyword (uppercase, with trailing JOIN).

is_inner property

is_inner: bool

True for :attr:INNER.

is_outer property

is_outer: bool

True for any of the three outer joins.

is_semi property

is_semi: bool

True for :attr:LEFT_SEMI / :attr:RIGHT_SEMI.

is_anti property

is_anti: bool

True for :attr:LEFT_ANTI / :attr:RIGHT_ANTI.

is_cross property

is_cross: bool

True for :attr:CROSS.

from_ classmethod

from_(value: Any, *, default: Any = ...) -> 'JoinType'

Coerce any Python value into a :class:JoinType.

Accepts:

  • :class:JoinType (returned as-is);
  • any string the alias table or canonical Arrow tokens know — "inner", "left", "left outer", "LEFT JOIN", "anti", "left_anti", "outer", "cross", …; mixed case, hyphens / underscores / spaces all normalize;
  • an integer code matching a member's value (round-trips with int(JoinType.X));
  • None — returns default if supplied, else raises.

default swallows unknown / unparseable input. Without it, unknown tokens raise :class:ValueError and unsupported types raise :class:TypeError.

is_valid classmethod

is_valid(value: Any) -> bool

Return True when :meth:from_ would succeed for value.