You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
what logic would you have SQLAlchemy apply here? Most blunt would be, configure() raises an error once any session has been created. I'm not sure what other options exist besides that. I can see some users having an issue with such a behavior.
I'm not sure what it should do, but if I change the code to explicitly create a session,
Maybe it could be a warning? My code is a multi-threaded web application so when not in testing a new scoped_session comes into play. At the console S.execute() gives the 'no bind' error but in the normal running application S.execute("SELECT 1") works despite import-time Query brokenness.
`
import sqlalchemy
from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
S = scoped_session(sessionmaker())
q = S.query(sqlalchemy.func.max())
def test_session():
the_engine = create_engine('sqlite://')
s = S(bind=the_engine)
s.execute("SELECT 1")
Migrated issue, originally created by Anonymous
Thankfully, it's very easy to not do the below. But when it's going on it is very unclear why the error has occurred.
Attachments: test_sqlalchemy.py
The text was updated successfully, but these errors were encountered: