I am wondering where it would be best to create a restricted session for use in falcon.
From reading the qtyqlalchemy code, in a round he roughly does the following:
from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker try: from greenlet import get_current as get_ident except ImportError: try: from thread import get_ident except ImportError: from _thread import get_ident connection_uri = 'postgresql://postgres:@localhost:5432/db' engine = create_engine(connection_uri) session_factory = sessionmaker(bind=engine) session_cls = scoped_session(session_factory, scopefunc=get_ident) session = session_cls()
Will this work for a falcon? Will get_ident func do the right thing when using a gun?
python falconframework flask-sqlalchemy sqlalchemy
synic
source share