Skip to content

Commit

Permalink
Apply the SQLAlchemy-0.6.8/SQLite workaround described in http://grou…
Browse files Browse the repository at this point in the history
  • Loading branch information
dabrahams committed Apr 29, 2011
1 parent 0512388 commit dfa4235
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions master/buildbot/db/enginestrategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,16 @@ def create(self, name_or_url, **kwargs):
# this module is really imported for the side-effects, but pyflakes will like
# us to use something from the module -- so offer a copy of create_engine, which
# explicitly adds the strategy argument
def create_engine(*args, **kwargs):
def create_engine(url, *args, **kwargs):
kwargs['strategy'] = 'buildbot'
return sqlalchemy.create_engine(*args, **kwargs)

# Use NullPool instead of the sqlalchemy-0.6.8-default
# SingletonThreadpool for sqlite to suppress the error in
# http://groups.google.com/group/sqlalchemy/msg/f8482e4721a89589,
# which also explains that NullPool is the new default in
# sqlalchemy 0.7
if url.startswith('sqlite:'):
from sqlalchemy.pool import NullPool
kwargs.setdefault('poolclass', NullPool)

return sqlalchemy.create_engine(url, *args, **kwargs)

0 comments on commit dfa4235

Please sign in to comment.