It seems OK though I am not a huge fan of "INSERT ON DUPLICATE KEY" as first off it's a MySQL thing, secondly, the behavior of insert/update defaults and such is difficult to predict when you don't know if a given row is to be insert or update, not to mention DBAPIs are all going to act awkwardly with it as well. The issue of MERGE and upsert is one that is so thorny, SQLAlchemy hasn't gotten into it yet, not even for Core. Getting ORM integration with it, that's not even on the radar for now, it would be a very hard problem to solve.
On Aug 5, 2014, at 7:07 PM, Milind Vaidya <[email protected]> wrote: > Can you please comment on implementation from following link: > > http://stackoverflow.com/questions/6611563/sqlalchemy-on-duplicate-key-update > > > On Tuesday, August 5, 2014 11:11:45 AM UTC-5, Milind Vaidya wrote: > Is there any way to achieve > > INSERT ON DUPLICATE KEY UPDATE and REPLACE INTO > > > query to solve this problem through sqlalchemy? > > > On Tuesday, July 29, 2014 10:00:46 AM UTC-5, Jonathan Vanasco wrote: > If you're doing a huge SELECT or batched INSERT/UPDATEs, the operation may be > more efficient -- but the transactions will be longer, which means you will > create issues with other connections. unless you grab exclusive locks on > tables, you also run a higher risk of integrity errors. > > In my experience, if the DB is in active use, you'll be better off with the > shortest transactions possible. > > I'm a big fan of loading things in parallel instead of serial, but I do that > for display -- not to select data for a long write operation. > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
