Commits

Mike Bayer committed c338755

renamed Column/ColumnClause "hidden" to "_is_oid"

  • Participants
  • Parent commits 77de22e

Comments (0)

Files changed (2)

File lib/sqlalchemy/schema.py

         which will be invoked upon insert if this column is not present in the insert list or is given a value
         of None.  The default expression will be converted into a ColumnDefault object upon initialization.
 
-        hidden=False : indicates this column should not be listed in the
-        table's list of columns.  Used for the "oid" column, which generally
-        isnt in column lists.
+        _is_oid=False : used internally to indicate that this column is used as the quasi-hidden "oid" column
 
         index=False : Indicates that this column is
         indexed. The name of the index is autogenerated.
         self.key = kwargs.pop('key', name)
         self._primary_key = kwargs.pop('primary_key', False)
         self.nullable = kwargs.pop('nullable', not self.primary_key)
-        self.hidden = kwargs.pop('hidden', False)
+        self._is_oid = kwargs.pop('_is_oid', False)
         self.default = kwargs.pop('default', None)
         self.index = kwargs.pop('index', None)
         self.unique = kwargs.pop('unique', None)
        return "Column(%s)" % string.join(
         [repr(self.name)] + [repr(self.type)] +
         [repr(x) for x in self.foreign_keys if x is not None] +
-        ["%s=%s" % (k, repr(getattr(self, k))) for k in ['key', 'primary_key', 'nullable', 'hidden', 'default', 'onupdate']]
+        ["%s=%s" % (k, repr(getattr(self, k))) for k in ['key', 'primary_key', 'nullable', 'default', 'onupdate']]
        , ',')
         
     def _get_parent(self):
     def _set_parent(self, table):
         if getattr(self, 'table', None) is not None:
             raise exceptions.ArgumentError("this Column already has a table!")
-        if not self.hidden:
+        if not self._is_oid:
             table._columns.add(self)
         if self.primary_key:
             table.primary_key.add(self)
 
     def copy(self): 
         """creates a copy of this Column, unitialized.  this is used in Table.tometadata."""
-        return Column(self.name, self.type, self.default, key = self.key, primary_key = self.primary_key, nullable = self.nullable, hidden = self.hidden, case_sensitive=self._case_sensitive_setting, quote=self.quote)
+        return Column(self.name, self.type, self.default, key = self.key, primary_key = self.primary_key, nullable = self.nullable, _is_oid = self._is_oid, case_sensitive=self._case_sensitive_setting, quote=self.quote)
         
     def _make_proxy(self, selectable, name = None):
         """create a "proxy" for this column.
         This is a copy of this Column referenced 
         by a different parent (such as an alias or select statement)"""
         fk = [ForeignKey(f._colspec) for f in self.foreign_keys]
-        c = Column(name or self.name, self.type, self.default, key = name or self.key, primary_key = self.primary_key, nullable = self.nullable, hidden = self.hidden, quote=self.quote, *fk)
+        c = Column(name or self.name, self.type, self.default, key = name or self.key, primary_key = self.primary_key, nullable = self.nullable, _is_oid = self._is_oid, quote=self.quote, *fk)
         c.table = selectable
         c.orig_set = self.orig_set
         c.__originating_column = self.__originating_column
-        if not c.hidden:
+        if not c._is_oid:
             selectable.columns.add(c)
             if self.primary_key:
                 selectable.primary_key.add(c)

File lib/sqlalchemy/sql.py

 class _ColumnClause(ColumnElement):
     """represents a textual column clause in a SQL statement.  May or may not
     be bound to an underlying Selectable."""
-    def __init__(self, text, selectable=None, type=None, hidden=False):
+    def __init__(self, text, selectable=None, type=None, _is_oid=False):
         self.key = self.name = text
         self.table = selectable
         self.type = sqltypes.to_instance(type)
-        self.hidden = hidden
+        self._is_oid = _is_oid
         self.__label = None
     def _get_label(self):
         if self.__label is None:
     def _bind_param(self, obj):
         return _BindParamClause(self._label, obj, shortname = self.name, type=self.type)
     def _make_proxy(self, selectable, name = None):
-        c = _ColumnClause(name or self.name, selectable, hidden=self.hidden, type=self.type)
+        c = _ColumnClause(name or self.name, selectable, _is_oid=self._is_oid, type=self.type)
         c.orig_set = self.orig_set
-        if not self.hidden:
+        if not self._is_oid:
             selectable.columns[c.name] = c
         return c
     def _compare_type(self, obj):
         self._primary_key = util.Set()
         for c in columns:
             self.append_column(c)
-        self._oid_column = _ColumnClause('oid', self, hidden=True)
+        self._oid_column = _ColumnClause('oid', self, _is_oid=True)
 
     def named_with_column(self):
         return True