You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using async client on SDK 0.4.1 and surrealdb 2.1.4, when I create records on schemaless table everything works fine. The moment I defined a field with a VALUE set, I can no longer create records using the SDK (tried both create and query methods, both result in a RuntimeError: Event loop stopped before Future completed. But the record gets created in the database!
Executing pure surrealQL on surrealist works fine.
Also I noticed that none of the SDK methods manipulating the record actually work when the field is defined
Steps to reproduce
# This works
res = await db.create(RecordID("test", "id1"), {"key": "value"})
print(f"Create1:\n{res}")
# This also works
res = await db.query(
"""DEFINE FIELD OVERWRITE created ON test TYPE option<datetime> VALUE $before OR time::now();"""
)
print(f"Query:\n{res}")
# This crashes the event loop
res = await db.create(RecordID("test", "id2"), {"key": "value"})
print(f"Create2:\n{res}"
Result:
Create1:
{'id': RecordID(table_name=test, record_id=id1), 'key': 'value'}
Query:
[{'result': None, 'status': 'OK', 'time': '98.096µs'}]
('no decoder for tag', 12)
Traceback (most recent call last):
File "app/dbtest.py", line 20, in <module>
asyncio.run(main())
File ".pyenv/versions/3.12.5/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File ".pyenv/versions/3.12.5/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".pyenv/versions/3.12.5/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete
raise RuntimeError('Event loop stopped before Future completed.')
RuntimeError: Event loop stopped before Future completed.
Side note:
running
res = await db.query("""UPSERT test:id5 CONTENT {key:"val"} RETURN NONE;""")
print(f"Query:\n{res}")
works fine.
Expected behaviour
I expect to be able to create the record when there is a defined table on the table, without crashing the event loop
SurrealDB version
2.1.4
surrealdb.py version
0.4.1
Contact Details
No response
Is there an existing issue for this?
I have searched the existing issues
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Describe the bug
Using async client on SDK 0.4.1 and surrealdb 2.1.4, when I create records on schemaless table everything works fine. The moment I defined a field with a VALUE set, I can no longer create records using the SDK (tried both create and query methods, both result in a
RuntimeError: Event loop stopped before Future completed.
But the record gets created in the database!Executing pure surrealQL on surrealist works fine.
Also I noticed that none of the SDK methods manipulating the record actually work when the field is defined
Steps to reproduce
Result:
Side note:
running
works fine.
Expected behaviour
I expect to be able to create the record when there is a defined table on the table, without crashing the event loop
SurrealDB version
2.1.4
surrealdb.py version
0.4.1
Contact Details
No response
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: