Here are the examples of the python api sqlalchemy.SAColumn taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
Example 1
def Column(*args, **kwargs):
"""Wrap the standard Column to allow to add some FormAlchemy options to a
model field. Basically label and renderer but all the values are passed to
:meth:`~formalchemy.fields.AbstractField.set`::
>>> from sqlalchemy import Integer
>>> from sqlalchemy.ext.declarative import declarative_base
>>> from formalchemy import Column
>>> Base = declarative_base()
>>> class MyArticle(Base):
... __tablename__ = 'myarticles'
... id = Column(Integer, primary_key=True, label='My id')
>>> MyArticle.__table__.c.id.info
{'label': 'My id'}
"""
info = kwargs.get('info', {})
drop = set()
for k, v in kwargs.items():
if k in column_options:
info[k] = v
drop.add(k)
for k in drop:
del kwargs[k]
if info:
kwargs['info'] = info
return SAColumn(*args, **kwargs)