本文整理汇总了Python中sqlalchemy.schema.Column.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Column.__init__方法的具体用法?Python Column.__init__怎么用?Python Column.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqlalchemy.schema.Column
的用法示例。
在下文中一共展示了Column.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sqlalchemy.schema import Column [as 别名]
# 或者: from sqlalchemy.schema.Column import __init__ [as 别名]
def __init__(self, *args, **kwargs):
""" Responsible for:
* Filter out type-specific kwargs and init Type using these.
* Filter out `_schema_class` kwargs and init `_schema_class`.
* Filter out column-slecific kwargs and init column using them.
* If `args` are provided, that means column proxy is being created.
In this case Type does not need to be created.
"""
if not hasattr(self, '_kwargs_backup'):
self._kwargs_backup = kwargs.copy()
type_args, type_kw, cleaned_kw = self.process_type_args(kwargs)
if not args:
schema_item, cleaned_kw = self._generate_schema_item(cleaned_kw)
column_kw = self.process_column_args(cleaned_kw)
# Column proxy is created by declarative extension
if args:
column_kw['name'], column_kw['type_'], schema_item = args
# Column init when defining a schema
else:
column_kw['type_'] = self._sqla_type_cls(*type_args, **type_kw)
if 'type_' not in kwargs:
self._init_kwargs = self._kwargs_backup.copy()
column_args = (schema_item,)
return Column.__init__(self, *column_args, **column_kw)
示例2: __init__
# 需要导入模块: from sqlalchemy.schema import Column [as 别名]
# 或者: from sqlalchemy.schema.Column import __init__ [as 别名]
def __init__(self):
Column.__init__(self, 'foo', Integer)