Example #1
0
 def created_at(self):
     """ Creation timestamp """
     column = Column(
         DateTime(timezone=True),
         server_default=func.now()
     )
     # pylint: disable=protected-access
     column._creation_order = 9900
     return column
Example #2
0
 def id(self):
     col_type = Integer
     col_kwargs = dict(autoincrement=True)
     info = dict(
         generated=True,
         ordering=0,
         exposed_name='id',
         type='Integer',
         nullable=False,
         unique=True,
     )
     col_args = getattr(self, '__id_args__', tuple())
     col_kwargs.update(getattr(self, '__id_kwargs__', dict()))
     id = Column(col_type,
                 *col_args,
                 primary_key=True,
                 info=info,
                 **col_kwargs)
     id._creation_order = -1
     return id
Example #3
0
def OColumn(*args, _order, **kwargs):
    '''manually-ordered column'''
    col = Column(*args, **kwargs)
    col._creation_order = _order
    return col
 def id(cls):
     column = Column(INTEGER, primary_key=True)
     column._creation_order = 0
     return column