class documentation

class set_shard_id(ORMOption): (source)

View In Hierarchy

a loader option for statements to apply a specific shard id to the primary query as well as for additional relationship and column loaders. The :class:`_horizontal.set_shard_id` option may be applied using the :meth:`_sql.Executable.options` method of any executable statement:: stmt = ( select(MyObject). where(MyObject.name == 'some name'). options(set_shard_id("shard1")) ) Above, the statement when invoked will limit to the "shard1" shard identifier for the primary query as well as for all relationship and column loading strategies, including eager loaders such as :func:`_orm.selectinload`, deferred column loaders like :func:`_orm.defer`, and the lazy relationship loader :func:`_orm.lazyload`. In this way, the :class:`_horizontal.set_shard_id` option has much wider scope than using the "shard_id" argument within the :paramref:`_orm.Session.execute.bind_arguments` dictionary. .. versionadded:: 2.0.0

Method __init__ Construct a :class:`_horizontal.set_shard_id` option.
Class Variable __slots__ Undocumented
Instance Variable propagate_to_loaders if True, indicate this option should be carried along to "secondary" SELECT statements that occur for relationship lazy loaders as well as attribute load / refresh operations.
Instance Variable shard_id Undocumented

Inherited from ORMOption:

Method _adapt_cached_option_to_uncached_option adapt this option to the "uncached" version of itself in a loader strategy context.
Class Variable _is_compile_state Undocumented
Class Variable _is_core Undocumented
Class Variable _is_criteria_option Undocumented
Class Variable _is_legacy_option Undocumented
Class Variable _is_strategy_option Undocumented
Class Variable _is_user_defined Undocumented

Inherited from ExecutableOption (via ORMOption):

Class Variable __visit_name__ Undocumented
Method _clone Create a shallow copy of this ExecutableOption.
Class Variable _is_has_cache_key Undocumented

Inherited from HasCopyInternals (via ORMOption, ExecutableOption):

Method _copy_internals Reassign internal elements to be clones of themselves.

Inherited from HasTraverseInternals (via ORMOption, ExecutableOption, HasCopyInternals):

Method get_children Return immediate child :class:`.visitors.HasTraverseInternals` elements of this :class:`.visitors.HasTraverseInternals`.
Class Variable _is_immutable Undocumented
Class Variable _traverse_internals Undocumented
def __init__(self, shard_id: ShardIdentifier, propagate_to_loaders: bool = True): (source)

Construct a :class:`_horizontal.set_shard_id` option. :param shard_id: shard identifier :param propagate_to_loaders: if left at its default of ``True``, the shard option will take place for lazy loaders such as :func:`_orm.lazyload` and :func:`_orm.defer`; if False, the option will not be propagated to loaded objects. Note that :func:`_orm.defer` always limits to the shard_id of the parent row in any case, so the parameter only has a net effect on the behavior of the :func:`_orm.lazyload` strategy.

propagate_to_loaders = (source)

if True, indicate this option should be carried along to "secondary" SELECT statements that occur for relationship lazy loaders as well as attribute load / refresh operations.

shard_id = (source)

Undocumented