Giter VIP home page Giter VIP logo

Comments (10)

frabcus avatar frabcus commented on July 3, 2024

The relevant Stack Overflow question is a bit depressing!

http://stackoverflow.com/questions/1109061/insert-on-duplicate-update-in-postgresql

On Tue, Sep 16, 2014 at 06:00:52AM -0700, Peter Waller wrote:

Turns out that postgres bails when we try to do a .save:

ProgrammingError: (ProgrammingError) syntax error at or near "OR"
LINE 1: INSERT OR REPLACE INTO test (a) VALUES ('b')
               ^
 'INSERT OR REPLACE INTO test (a) VALUES (%(a)s)' {'a': 'b'}

Reply to this email directly or view it on GitHub:
#63

from scraperwiki-python.

pwaller avatar pwaller commented on July 3, 2024

Yes. Yes it is.

from scraperwiki-python.

pwaller avatar pwaller commented on July 3, 2024

Looks like there is an sqlalchemy issue tracking the CTE method: https://bitbucket.org/zzzeek/sqlalchemy/issue/2551

from scraperwiki-python.

pwaller avatar pwaller commented on July 3, 2024

"What's fascinating is that Postgresql, which in most cases supports way more than all the other DBs, doesn't yet support MERGE, which is a cleaner bit of SQL and is also part of the ANSI standard."

from scraperwiki-python.

pwaller avatar pwaller commented on July 3, 2024

"Why upsert is weird"

from scraperwiki-python.

pwaller avatar pwaller commented on July 3, 2024

From the slides:

image

from scraperwiki-python.

tlevine avatar tlevine commented on July 3, 2024

SQLAlchemy has session.merge

On September 16, 2014 10:15:50 AM EDT, Peter Waller [email protected] wrote:

From the slides:

image


Reply to this email directly or view it on GitHub:
#63 (comment)

from scraperwiki-python.

pwaller avatar pwaller commented on July 3, 2024

Can you use that if you're not using the ORM?

from scraperwiki-python.

pwaller avatar pwaller commented on July 3, 2024

Searching the docs, that's only applicable to the ORM - the reason it can do it there is because if you have an object instance, then sqlalchemy knows what you changed. So it doesn't help us here - sqlalchemy just invokes an insert or update as appropriate.

from scraperwiki-python.

pwaller avatar pwaller commented on July 3, 2024

Looks like it just grew support.

https://news.ycombinator.com/item?id=9509870

from scraperwiki-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.