def __init__(self, db, **options): self.db = db bind = options.pop("bind", None) or db.engine query_cls = options.pop("query_cls", None) or db.query_class session_options = merge_dicts(dict(autocommit=False, autoflush=False), db._session_options) Session.__init__(self, bind=bind, query_cls=query_cls, **session_options) if SQLALCHEMY_VERSION >= "1.4.0": event.listen(self, "do_orm_execute", self.receive_do_orm_execute)
def __init__(self, bind=None, autoflush=True, expire_on_commit=True, _enable_transaction_accounting=True, autocommit=False, twophase=False, weak_identity_map=True, binds=None, extension=None, info=None, query_cls=query.Query): _Session.__init__(self, bind=bind, autoflush=autoflush, expire_on_commit=expire_on_commit, _enable_transaction_accounting=_enable_transaction_accounting, autocommit=autocommit, twophase=twophase, weak_identity_map=weak_identity_map, binds=binds, extension=extension, info=info, query_cls=query_cls) _binds = {} _binds.update(self.__binds) self.__tags = self.__tags__ for i, b in self.__binds.items(): # _tag = i.tag # if _tag and _tag not in self.__tags: # self.__tags.append(_tag) if isinstance(i, Table): _binds[repr(i)] = b else: _binds[i] = b self.__tags = sorted(self.__tags) self.__binds = _binds
def __init__(self, *args, **kwargs): self.dbg_label = kwargs.pop('dbg_label') Session.__init__(self, *args, **kwargs)