]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- more docstrings
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 28 Sep 2007 17:20:24 +0000 (17:20 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 28 Sep 2007 17:20:24 +0000 (17:20 +0000)
- Selectable is only used as a marker for FromClause (probably should be
removed/both classes merged)

lib/sqlalchemy/sql/expression.py

index 0dbde749fe6271e04742ef100e4143359b134d61..9a9cf65d22118371647e572ec01b4976921b5fb1 100644 (file)
@@ -1326,21 +1326,6 @@ class _CompareMixin(ColumnOperators):
 
         return obj.type
 
-class Selectable(ClauseElement):
-    """Represent a column list-holding object.
-
-    This is the common base class of [sqlalchemy.sql.expression#ColumnElement]
-    and [sqlalchemy.sql.expression#FromClause].  The reason ``ColumnElement`` is
-    marked as a "list-holding" object is so that it can be treated
-    similarly to ``FromClause`` in column-selection scenarios; it
-    contains a list of columns consisting of itself.
-    """
-
-    columns = util.NotImplProperty("""a [sqlalchemy.sql.expression#ColumnCollection] containing ``ColumnElement`` instances.""")
-
-    def select(self, whereclauses = None, **params):
-        return select([self], whereclauses, **params)
-
 class ColumnElement(ClauseElement, _CompareMixin):
     """Represent an element that is usable within the "column clause" portion of a ``SELECT`` statement.
 
@@ -1503,6 +1488,9 @@ class ColumnSet(util.OrderedSet):
                     l.append(c==local)
         return and_(*l)
 
+class Selectable(ClauseElement):
+    """mark a class as being selectable"""
+    
 class FromClause(Selectable):
     """Represent an element that can be used within the ``FROM`` clause of a ``SELECT`` statement."""
 
@@ -1520,19 +1508,32 @@ class FromClause(Selectable):
         return [self.oid_column]
 
     def count(self, whereclause=None, **params):
+        """return a SELECT COUNT generated against this ``FromClause``."""
+        
         if self.primary_key:
             col = list(self.primary_key)[0]
         else:
             col = list(self.columns)[0]
         return select([func.count(col).label('tbl_row_count')], whereclause, from_obj=[self], **params)
 
+    def select(self, whereclauses = None, **params):
+        """return a SELECT of this ``FromClause``."""
+        
+        return select([self], whereclauses, **params)
+
     def join(self, right, *args, **kwargs):
+        """return a join of this ``FromClause`` against another ``FromClause``."""
+        
         return Join(self, right, *args, **kwargs)
 
     def outerjoin(self, right, *args, **kwargs):
+        """return an outer join of this ``FromClause`` against another ``FromClause``."""
+
         return Join(self, right, isouter=True, *args, **kwargs)
 
     def alias(self, name=None):
+        """return an alias of this ``FromClause`` against another ``FromClause``."""
+
         return Alias(self, name)
 
     def named_with_column(self):