Skip to content

Bug: subscribe_live() returns only the record payload and drops action in Python SDK 2.0.0 #247

Description

@Zanehb

Describe the bug

In the Python SDK surrealdb==2.0.0, subscribe_live() appears to return only the inner record payload from a live query notification, instead of returning the full notification object containing action and result.

According to the Python SDK documentation, live query notifications should contain:

{
"action": "CREATE" | "UPDATE" | "DELETE",
"result": ...
}

However, the current behavior only returns the changed record itself, so notification["action"] raises a KeyError.

Steps to reproduce

from surrealdb import Surreal

with Surreal("ws://") as db:
db.signin({
"username": "root",
"password": "secret"
})

db.use("lab", "lab")

query_uuid = db.live("person")

print("query_uuid =", query_uuid)
print("query_uuid type =", type(query_uuid))

for notification in db.subscribe_live(query_uuid):
    print("raw notification =", notification)
    print("notification type =", type(notification))

    if isinstance(notification, dict):
        print("keys =", notification.keys())

    print(notification["action"])
    print(notification["result"])

Expected behaviour

{
"action": "CREATE" | "UPDATE" | "DELETE",
"result": ...
}

SurrealDB version

surreal 3.0.5

surrealdb.py version

surrealdb.py==2.0.0, windows

Contact Details

No response

Is there an existing issue for this?

  • I have searched the existing issues

Code of Conduct for repository surrealdb/surrealdb.py

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions