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/Noneinput with alias support ("left"→LEFT_OUTER,"anti"→LEFT_ANTI,"LEFT JOIN"→LEFT_OUTER); - :meth:
is_validfor boolean checks without raising; - :attr:
arrow/ :attr:polars/ :attr:sqlfor engine-specific spellings, plus :attr:is_outer/ :attr:is_semi/ :attr:is_anti/ :attr:is_inner/ :attr:is_crosspredicates.
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.
polars
property
¶
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.
from_
classmethod
¶
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
¶
Return True when :meth:from_ would succeed for value.