surrealdb / surrealdb.py

SurrealDB SDK for Python
https://surrealdb.com
Apache License 2.0
170 stars 49 forks source link

fix #79 #80

Closed mivinci closed 2 months ago

mivinci commented 7 months ago

Thank you for submitting this pull request! We appreciate you spending the time to work on these changes.

What is the motivation?

The current HTTP client has no method merge to partially update record(s) by performing a query like

UPDATE person:tobbie MERGE {
    settings: {
        active: true
    }
};

So I solved it according to the official documentation from https://surrealdb.com/docs/integration/http#modify-one.

Type of Change

What does this change do?

Adding the merge method to class SurrealHTTP.

What is your testing strategy?

db = SurrealHTTP(...)
await db.merge('person:tobbie', {
    'settings': {
        'active': True
    }
})

which should and did output the modified record.

Is this related to any issues?

https://github.com/surrealdb/surrealdb.py/issues/79

Have you read the Contributing Guidelines?