def includeme(config): # Add a directive to get an alembic configuration. config.add_directive("alembic_config", _configure_alembic) # Create our SQLAlchemy Engine. config.registry["sqlalchemy.engine"] = sqlalchemy.create_engine( config.registry.settings["database.url"], isolation_level="SERIALIZABLE", ) # Register our request.db property config.add_request_method(_create_session, name="db", reify=True)
def includeme(config): # Add a directive to get an alembic configuration. config.add_directive("alembic_config", _configure_alembic) # Create our SQLAlchemy Engine. config.registry["sqlalchemy.engine"] = _create_engine( config.registry.settings["database.url"]) # Register our request.db property config.add_request_method(_create_session, name="db", reify=True) # Add a route predicate to mark a route as read only. config.add_route_predicate("read_only", ReadOnlyPredicate) # Add a request.read_only property which can be used to determine if a # request is being acted upon as a read-only request or not. config.add_request_method(_readonly, name="read_only", reify=True)
def includeme(config): # Add a directive to get an alembic configuration. config.add_directive("alembic_config", _configure_alembic) # Create our SQLAlchemy Engine. config.registry["sqlalchemy.engine"] = _create_engine( config.registry.settings["database.url"], ) # Register our request.db property config.add_request_method(_create_session, name="db", reify=True) # Add a route predicate to mark a route as read only. config.add_route_predicate("read_only", ReadOnlyPredicate) # Add a request.read_only property which can be used to determine if a # request is being acted upon as a read-only request or not. config.add_request_method(_readonly, name="read_only", reify=True)
def includeme(config): # Hook request lifecycle to a transaction and retry transient failures config.include('pyramid_tm') config.include('pyramid_retry') # Add a directive to get an alembic configuration. config.add_directive("alembic_config", _configure_alembic) # Create our SQLAlchemy Engine. config.add_directive("sqlalchemy_engine", _create_engine) config.add_directive("add_model", attach_model_to_base) # Register our request.db property config.add_request_method(_create_session, name="db", reify=True) # Add a route predicate to mark a route as read only. config.add_view_deriver(readonly_view_deriver, under=INGRESS) config.scan('.')