Changeset - a3df76ea9818
[Not reviewed]
0 1 0
Lance Edgar (lance) - 2 months ago 2024-09-03 11:13:15
lance@edbob.org
fix: move startup workaround for trainwreck query bug

apparently this workaround will break alembic commands since
versioning must be handled a bit differently in that scenario. so
must only do the workaround if versioning is enabled during the
startup sequence..
1 file changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
rattail/config.py
Show inline comments
 
@@ -779,12 +779,6 @@ def make_config(
 
        from rattail.db.config import configure_versioning
 
        configure_versioning(config)
 

	
 
    # maybe set "future" behavior for SQLAlchemy
 
    if config.get_bool('rattail.db.sqlalchemy_future_mode', usedb=False):
 
        from rattail.db import Session
 
        if Session:
 
            Session.configure(future=True)
 

	
 
        # TODO: holy crap why is this needed?  without it, the first time
 
        # a trainwreck query happens, InvalidRequestError is raised.  but
 
        # this is clearly a trainwreck query, and yet no error if we do it
 
@@ -802,6 +796,12 @@ def make_config(
 
                trainwreck_session.query(trainwreck_model.Transaction).first()
 
                trainwreck_session.close()
 

	
 
    # maybe set "future" behavior for SQLAlchemy
 
    if config.get_bool('rattail.db.sqlalchemy_future_mode', usedb=False):
 
        from rattail.db import Session
 
        if Session:
 
            Session.configure(future=True)
 

	
 
    return config
 

	
 

	
0 comments (0 inline, 0 general)