Re: [sqlalchemy] many-to-many relationship : how to update items properly if there are duplicates entries ?

2017-05-23 Thread yoch . melka
Thank you Mike for this detailled response ! The UniqueObject recipe is very interesting, but not very suitable to my case because my webservice don't use the same session on each Post insertion. Maybe a session.merge_all() method can help to improve performance in such cases by grouping the

Re: [sqlalchemy] many-to-many relationship : how to update items properly if there are duplicates entries ?

2017-05-23 Thread mike bayer
we don't have ON DUPLICATE KEY UPDATE for MySQL as of yet however there is a PR that I will attend to at some point for possible 1.2 inclusion. However, note you can just as well just emit the SQL string for ON DUPLCIATE KEY UPDATE if you're only targeting MySQL. Then just create the object

Re: [sqlalchemy] When is session.close required?

2017-05-23 Thread mike bayer
On 05/23/2017 09:55 AM, 'Brian Candler' via sqlalchemy wrote: Hello, I have a question about when "close" should or should not be called on a session. At http://docs.sqlalchemy.org/en/latest/orm/session_transaction.html it says: "When the transactional state is completed after a

[sqlalchemy] When is session.close required?

2017-05-23 Thread 'Brian Candler' via sqlalchemy
Hello, I have a question about when "close" should or should not be called on a session. At http://docs.sqlalchemy.org/en/latest/orm/session_transaction.html it says: "When the transactional state is completed after a rollback or commit, the Session releases all Transaction and Connection