def __init__(self, hub): self.hub = hub self.log = log # If the stream specifies an 'app', then setup `self.engine` to # be a SQLAlchemy engine for that app, along with a configured DBSession app = getattr(self, 'app', None) self.engine = self.DBSession = None if app: log.debug("Setting up individual engine for producer") from sqlalchemy.orm import sessionmaker self.engine = create_app_engine(app) self.DBSession = sessionmaker(bind=self.engine)()
def __init__(self, hub): self.hub = hub self.log = log # If the stream specifies an 'app', then setup `self.engine` to # be a SQLAlchemy engine for that app, along with a configured DBSession app = getattr(self, "app", None) self.engine = self.DBSession = None if app: log.debug("Setting up individual engine for producer") from sqlalchemy.orm import sessionmaker self.engine = create_app_engine(app) self.DBSession = sessionmaker(bind=self.engine)()
def __init__(self, hub): self.hub = hub self.log = log callback = self._consume if self.jsonify: callback = self._consume_json for topic in listify(self.topic): log.debug('Subscribing to consumer topic %s' % topic) self.hub.subscribe(topic, callback) # If the consumer specifies an 'app', then setup `self.engine` to # be a SQLAlchemy engine, along with a configured DBSession app = getattr(self, 'app', None) self.engine = self.DBSession = None if app: log.debug("Setting up individual engine for consumer") from sqlalchemy.orm import sessionmaker self.engine = create_app_engine(app, hub.config) self.DBSession = sessionmaker(bind=self.engine)() self._initialized = True
def __init__(self, hub): self.hub = hub self.log = log callback = self._consume if self.jsonify: callback = self._consume_json for topic in iterate(self.topic): log.debug('Subscribing to consumer topic %s' % topic) self.hub.subscribe(topic, callback) # If the consumer specifies an 'app', then setup `self.engine` to # be a SQLAlchemy engine, along with a configured DBSession app = getattr(self, 'app', None) self.engine = self.DBSession = None if app: log.debug("Setting up individual engine for consumer") from sqlalchemy.orm import sessionmaker self.engine = create_app_engine(app, hub.config) self.DBSession = sessionmaker(bind=self.engine)() self._initialized = True