summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2015-01-04 18:30:25 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2015-01-04 18:30:25 -0500
commit27816e8f61b861c5f8718bfb0f1be745ef204040 (patch)
tree8deb7f97966dbbcd5f326f3936adf654c63ed218 /lib/sqlalchemy/orm
parentcf272325635c1205da7fd2668eac3c8ac409dafb (diff)
downloadsqlalchemy-27816e8f61b861c5f8718bfb0f1be745ef204040.tar.gz
- strategies + declarative
Diffstat (limited to 'lib/sqlalchemy/orm')
-rw-r--r--lib/sqlalchemy/orm/interfaces.py2
-rw-r--r--lib/sqlalchemy/orm/strategies.py23
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/interfaces.py b/lib/sqlalchemy/orm/interfaces.py
index bff73258c..68b86268c 100644
--- a/lib/sqlalchemy/orm/interfaces.py
+++ b/lib/sqlalchemy/orm/interfaces.py
@@ -560,6 +560,8 @@ class LoaderStrategy(object):
"""
+ __slots__ = 'parent_property', 'is_class_level', 'parent', 'key'
+
def __init__(self, parent):
self.parent_property = parent
self.is_class_level = False
diff --git a/lib/sqlalchemy/orm/strategies.py b/lib/sqlalchemy/orm/strategies.py
index d95f17f64..4e47a8f24 100644
--- a/lib/sqlalchemy/orm/strategies.py
+++ b/lib/sqlalchemy/orm/strategies.py
@@ -105,6 +105,8 @@ class UninstrumentedColumnLoader(LoaderStrategy):
if the argument is against the with_polymorphic selectable.
"""
+ __slots__ = 'columns',
+
def __init__(self, parent):
super(UninstrumentedColumnLoader, self).__init__(parent)
self.columns = self.parent_property.columns
@@ -128,6 +130,8 @@ class UninstrumentedColumnLoader(LoaderStrategy):
class ColumnLoader(LoaderStrategy):
"""Provide loading behavior for a :class:`.ColumnProperty`."""
+ __slots__ = 'columns', 'is_composite'
+
def __init__(self, parent):
super(ColumnLoader, self).__init__(parent)
self.columns = self.parent_property.columns
@@ -176,6 +180,8 @@ class ColumnLoader(LoaderStrategy):
class DeferredColumnLoader(LoaderStrategy):
"""Provide loading behavior for a deferred :class:`.ColumnProperty`."""
+ __slots__ = 'columns', 'group'
+
def __init__(self, parent):
super(DeferredColumnLoader, self).__init__(parent)
if hasattr(self.parent_property, 'composite_class'):
@@ -300,6 +306,8 @@ class LoadDeferredColumns(object):
class AbstractRelationshipLoader(LoaderStrategy):
"""LoaderStratgies which deal with related objects."""
+ __slots__ = 'mapper', 'target', 'uselist'
+
def __init__(self, parent):
super(AbstractRelationshipLoader, self).__init__(parent)
self.mapper = self.parent_property.mapper
@@ -316,6 +324,8 @@ class NoLoader(AbstractRelationshipLoader):
"""
+ __slots__ = ()
+
def init_class_attribute(self, mapper):
self.is_class_level = True
@@ -343,6 +353,10 @@ class LazyLoader(AbstractRelationshipLoader):
"""
+ __slots__ = (
+ '_lazywhere', '_rev_lazywhere', 'use_get', '_bind_to_col',
+ '_equated_columns', '_rev_bind_to_col', '_rev_equated_columns')
+
def __init__(self, parent):
super(LazyLoader, self).__init__(parent)
join_condition = self.parent_property._join_condition
@@ -647,6 +661,8 @@ class LazyLoader(AbstractRelationshipLoader):
class LoadLazyAttribute(object):
"""serializable loader object used by LazyLoader"""
+ __slots__ = 'key',
+
def __init__(self, key):
self.key = key
@@ -661,6 +677,8 @@ class LoadLazyAttribute(object):
@properties.RelationshipProperty.strategy_for(lazy="immediate")
class ImmediateLoader(AbstractRelationshipLoader):
+ __slots__ = ()
+
def init_class_attribute(self, mapper):
self.parent_property.\
_get_strategy_by_cls(LazyLoader).\
@@ -684,6 +702,8 @@ class ImmediateLoader(AbstractRelationshipLoader):
@log.class_logger
@properties.RelationshipProperty.strategy_for(lazy="subquery")
class SubqueryLoader(AbstractRelationshipLoader):
+ __slots__ = 'join_depth',
+
def __init__(self, parent):
super(SubqueryLoader, self).__init__(parent)
self.join_depth = self.parent_property.join_depth
@@ -1069,6 +1089,9 @@ class JoinedLoader(AbstractRelationshipLoader):
using joined eager loading.
"""
+
+ __slots__ = 'join_depth',
+
def __init__(self, parent):
super(JoinedLoader, self).__init__(parent)
self.join_depth = self.parent_property.join_depth