本文整理汇总了Python中sqlalchemy.ext.declarative.DeclarativeMeta.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python DeclarativeMeta.__init__方法的具体用法?Python DeclarativeMeta.__init__怎么用?Python DeclarativeMeta.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqlalchemy.ext.declarative.DeclarativeMeta
的用法示例。
在下文中一共展示了DeclarativeMeta.__init__方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _with_register_classes
# 需要导入模块: from sqlalchemy.ext.declarative import DeclarativeMeta [as 别名]
# 或者: from sqlalchemy.ext.declarative.DeclarativeMeta import __init__ [as 别名]
def _with_register_classes(cls, fn):
"""Run a setup method, framing the operation with a Base class
that will catch new subclasses to be established within
the "classes" registry.
"""
cls_registry = cls.classes
class FindFixture(type):
def __init__(cls, classname, bases, dict_):
cls_registry[classname] = cls
return type.__init__(cls, classname, bases, dict_)
class _Base(util.with_metaclass(FindFixture, object)):
pass
class Basic(BasicEntity, _Base):
pass
class Comparable(ComparableEntity, _Base):
pass
cls.Basic = Basic
cls.Comparable = Comparable
fn()
示例2: __init__
# 需要导入模块: from sqlalchemy.ext.declarative import DeclarativeMeta [as 别名]
# 或者: from sqlalchemy.ext.declarative.DeclarativeMeta import __init__ [as 别名]
def __init__(self, app=None, use_native_unicode=True, session_options=None, metadata=None):
if session_options is None:
session_options = {}
session_options.setdefault('scopefunc', connection_stack.__ident_func__)
self.use_native_unicode = use_native_unicode
self.session = self.create_scoped_session(session_options)
self.Model = self.make_declarative_base(metadata)
self.Query = BaseQuery
self._engine_lock = Lock()
self.app = app
_include_sqlalchemy(self)
if app is not None:
self.init_app(app)