web/db/sa.py
def start(self, context):
		"""Construct the SQLAlchemy engine and session factory."""
		
		if __debug__:
			log.info("Connecting SQLAlchemy database layer.", extra=dict(
					uri = redact_uri(self.uri),
					config = self.config,
					alias = self.alias,
				))
		
		# Construct the engine.
		engine = self.engine = create_engine(self.uri, **self.config)
		
		# Construct the session factory.
		self.Session = scoped_session(sessionmaker(bind=engine))
		
		# Test the connection.
		engine.connect().close()
		
		# Assign the engine to our database alias.
		context.db[self.alias] = engine
def start(self, context):
		"""Construct the SQLAlchemy engine and session factory."""
		
		if __debug__:
			log.info("Connecting SQLAlchemy database layer.", extra=dict(
					uri = redact_uri(self.uri),
					config = self.config,
					alias = self.alias,
				))
		
		# Construct the engine.
		engine = self.engine = create_engine(self.uri, **self.config)
		
		# Construct the session factory.
		self.Session = scoped_session(sessionmaker(bind=engine))
		
		# Test the connection.
		engine.connect().close()
		
		# Assign the engine to our database alias.
		context.db[self.alias] = engine
Construct the SQLAlchemy engine and session factory.