Git Product home page Git Product logo

Comments (8)

brianrusso avatar brianrusso commented on May 26, 2024

Do you mean like a PATCH? I.e. a partial update on an existing record?

this_col.update(this_item, merge=True)

where this_col = collection
this_item = dict w/partial records to update.

On Fri, Nov 4, 2016 at 4:46 AM, Cemre Mengu [email protected]
wrote:

Is there anyway to do an upsert without using "AQL" ?

Something like collection.upsert(data)


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#27, or mute the thread
https://github.com/notifications/unsubscribe-auth/AF_EDAMtRWgDG2FKdITURAhx2VFGWeuKks5q6vECgaJpZM4KpThj
.

Brian Russo / (808) 271 4166

from python-arango.

cemremengu avatar cemremengu commented on May 26, 2024

Not exactly @brianrusso

I mean an operation where it updates the record if exists or creates a new one otherwise

from python-arango.

brianrusso avatar brianrusso commented on May 26, 2024

Arango's REST API doesn't expose UPSERT; so you have to do it with AQL.

On Sat, Nov 5, 2016 at 4:14 PM, Cemre Mengu [email protected]
wrote:

Not exactly @brianrusso https://github.com/brianrusso

I mean an operation where it updates the record if exists or creates a new
one otherwise


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#27 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF_EDMjg6kPJQZooCgwXhpMu6RIQD8PJks5q7OOcgaJpZM4KpThj
.

Brian Russo / (808) 271 4166

from python-arango.

cemremengu avatar cemremengu commented on May 26, 2024

Nice, thanks I ended up writing a wrapper function for it. All good.

from python-arango.

Bennyelg avatar Bennyelg commented on May 26, 2024

@cemremengu can you share ?

I tried

        sys_db.aql.execute(
            f"""
            UPSERT {{_key: {str(PREFIX_CONVERTER[event_metadata[2]]) + str(json_payload["order_id"])} }}
            INSERT {doc}
            UPDATE {{ version: OLD.version + 1 }} IN events OPTIONS {{ exclusive: true }}
            """
        )

without success.

from python-arango.

cemremengu avatar cemremengu commented on May 26, 2024

@Bennyelg sorry its been a long time, I dont use these techs currently :/

from python-arango.

Bennyelg avatar Bennyelg commented on May 26, 2024

@cemremengu thanks

from python-arango.

Himan000 avatar Himan000 commented on May 26, 2024

@joowani ,
As for as I know, arango provided upsert function, can you provide too in arango-python?

Using OLD and NEW in the same query
For UPDATE , REPLACE and UPSERT statements, both OLD and NEW can be used to return the previous revision of a document
together with the updated revision:
FOR u IN users
FILTER u.status == "not active"
UPDATE u WITH { status: "inactive" } IN users
RETURN { old: OLD, new: NEW }

from python-arango.

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.