本文整理匯總了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)