pokeminer icon indicating copy to clipboard operation
pokeminer copied to clipboard

SQLAlchemy compatibility - pool_size error

Open AyalaJuan opened this issue 8 years ago • 3 comments

Was receiving pool_size errors when trying to import db using the python instructions (Linux).

Encountered the following error:

>>> import db Traceback (most recent call last): File "<stdin>", line 1, in <module> File "db.py", line 156, in <module> Session = sessionmaker(bind=get_engine()) File "db.py", line 27, in get_engine return create_engine(DB_ENGINE,pool_size=61) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/__init__.py", line 386, in create_engine return strategy.create(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/strategies.py", line 144, in create engineclass.__name__)) TypeError: Invalid argument(s) 'pool_size' sent to create_engine(), using configuration SQLiteDialect_pysqlite/NullPool/Engine. Please check that the keyword arguments are appropriate for this combination of components.

Fix: I found the following article that explains the problem --

http://stackoverflow.com/questions/15973481/sqlalchemy-pool-size-and-sqlite

Basically the issue happens to be with SQLAlchemy compatibility per version upgrades and after much digging I found out I had to change a line in db.py - Line 27

From: return create_engine(DB_ENGINE,pool_size=config.GRID[0]*config.GRID[1]+5)

To: return create_engine(DB_ENGINE)

Hope this helps somebody. This was an initial run. If people have old databases and are upgrading read the stackoverflow article carefully - I'm not a DB admin so wouldn't be able to provide feedback on that.

AyalaJuan avatar Aug 10 '16 05:08 AyalaJuan

Your a champion AyalaJuan, thank you! This resolved the issue for me.

TristanHM avatar Aug 10 '16 05:08 TristanHM

I just added that pool size yesterday to fix various other users problems.

And since the issue explains it: the way to fix this for more users seems to be: return create_engine(DB_ENGINE,pool_size=config.GRID[0]*config.GRID[1]+5,poolclass=SingletonThreadPool)

Aiyubi avatar Aug 10 '16 07:08 Aiyubi

Definitely more elegant than my way.

I admit I did not test it fully - it worked the other way and I ran with it =)

Thanks!

AyalaJuan avatar Aug 10 '16 07:08 AyalaJuan