[sqlalchemy] [sqlalchemy/postgreSQL] way to handle server-end timeout

2018-01-11 Thread gingerluo
Hello, Is below the way to reconnect to postgresql server automatically? everytime I need to remake a session with "Session = sessionmaker(bind=engine) session = Session()" , is this right? the codes below can work, but if I don't remake the session, it will failed at server timeout. #!/bin/

Re: [sqlalchemy] Re: Temporarily disable DB persistence for optimization routine

2018-01-11 Thread Mike Bayer
I can't give you much detail except to say the unique object recipe is doing an .add() when it finds an identity that isn't taken, if you don't want those persisted then take out the part of the recipe doing add(). However, you'd need to alter the recipe further such that if the program asks for t

Re: [sqlalchemy] Re: Support for native PostgreSQL "polygon" type?

2018-01-11 Thread Alec Benzer
Demitri, any plans (or previous attempts) to integrate this into SQLAlchemy proper? On Tuesday, September 8, 2015 at 1:00:22 AM UTC-4, Demitri Muna wrote: > > Hi Michael, > > > On Monday, September 7, 2015 at 5:40:02 PM UTC-4, Michael Bayer wrote: >> >> SQLAlchemy doesn't do much else with types

Re: [sqlalchemy] Polymorphic discriminator not being added to update queries

2018-01-11 Thread Mike Bayer
The update and delete methods on query are for performance optimization and potentially for atomicity in some situations, and thus dont assume much about how the UPDATE should proceed. Adding the discriminator for simple cases is not that hard to implement but would be backwards incompatible and a

Re: [sqlalchemy] Polymorphic discriminator not being added to update queries

2018-01-11 Thread Simon King
On Thu, Jan 11, 2018 at 4:51 PM, Mischa S wrote: > In [6]: ClassificationTask.query.update(values={'completed': True}) > INFO [sqlalchemy.engine.base.Engine] base.py:679 BEGIN (implicit) > INFO [sqlalchemy.engine.base.Engine] base.py:1140 UPDATE schwartz_task > SET completed=%(completed)s

[sqlalchemy] Polymorphic discriminator not being added to update queries

2018-01-11 Thread Mischa S
In [6]: ClassificationTask.query.update(values={'completed': True}) INFO [sqlalchemy.engine.base.Engine] base.py:679 BEGIN (implicit) INFO [sqlalchemy.engine.base.Engine] base.py:1140 UPDATE schwartz_task SET completed=%(completed)s INFO [sqlalchemy.engine.base.Engine] base.py:1143 {'c

[sqlalchemy] Re: Temporarily disable DB persistence for optimization routine

2018-01-11 Thread Ruben Di Battista
Last copy paste went wrong. The uniqueness is ensured by: @event.listens_for(orm.session.Session, "after_attach") def after_attach(session, instance): # when ConstrainedSatellite objects are attached to a Session, # figure out if in the database there's already the Constraint, # requ

[sqlalchemy] Re: Temporarily disable DB persistence for optimization routine

2018-01-11 Thread Ruben Di Battista
Dear Mike, thank you for the fast response as usual. Your comment made me think. Actually I was not adding things in the session directly. I revised my code and I believe the behaviour I'm describing is related to the application of the UniqueObject patter described in the documentation. W