Avoid Socket Timeouts in SQLAlchemy

I am new to SQLAlchemy, but I am trying to use it to create and populate a database for a personal project. I set pool_timeoutto 43200 (twelve hours), but I still get socket timeouts.

engine = sqlalchemy.create_engine(
            'postgresql+pg8000://gdwatson:pass@localhost/dbname',
            pool_timeout=43200)
db.tables.meta.drop_all(bind=engine)
db.tables.meta.create_all(bind=engine)

conn = engine.connect()
dataset = build_dataset()
conn.execute(db.tables.mytable.insert(),
             dataset)
conn.close()

In the end, I get socket.timeout: timed outafter a lot of processing time, but probably up to an hour and, of course, up to two. These are actually three levels in depth - when processing a timeout exception, something else happened, and then when accessing this other one. (Perhaps this is a repetition of the library?) An exception occurs in conn.execute, and I do not understand how to prevent it.

There is nothing informative in the search. I am using Python 3.1 and SQLAlchemy 0.6.1, for what it's worth it.

+5
1

, , SELECT 1 , .

+2

All Articles