-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: #110
Comments
Not sure what the status is on this bug, but I've noticed that this issue is still ongoing as of SurrealDB v2.1.3 and SDK v0.4.1 Attempting to insert datetime as a data type is returning an exception: Code [connection_address is ws://<ip_address>:8000]:
Result:
I've tried through upserting, inserting, and through a custom query for both which always ends up as the same result. Clearly the issue is still open, so presuming that this is still known. Modifying it this way does seem to resolve the bug:
However, the formatting in SurrealDB does not reflect a standard d'timestamp here' and does not auto convert to a human readable format in Surrealist as it would without .isoformat(). Additionally, it looks closer to a string value when in .isoformat() so I can't tell if it's getting read as datetime or as a string value for sure once it's placed in the database. It is however classified in python as a datetime value when appended with .isoformat(). Edit: After further evaluation in Surrealist, this is likely just a string still, so can't really say that it resolved this way. .isoformat(): |
Same issue here.. SurrealDB expects us to send dates as d'2023-07-17T07:18:52Z' but there is no practical way to do that in Python and there seems to be no helper function in the SDK for that either. What's the right way to use datetime with the Python SDK, guys? |
I ended up building a simple Pydantic ORM implementation for Surreal which I plan to add to later. Feel free to contribute if you guys like the idea. |
Describe the bug
insert datetime value to table
Steps to reproduce
I want insert this {'date': '2023-07-03T07:18:52.841147', 'open': 27430.0, 'high': 27730.0, 'low': 27420.0, 'close': 27720.0, 'final': 27490.0, 'y_final': 27190.0, 'vol': 713407.0, 'val': 19755901740.0, 'count': 560.0, 'ins': 'instrument:IRO1ABIK0001'} record to databse but resive this error surrealdb.ws.SurrealPermissionException: There was a problem with the database: Found '2023-07-03T07:18:52.841147' for field date, with record trade:mb5zls5xah1xyo4rsa1o, but expected a datetime. how can fixed it?
Expected behaviour
insert record.
SurrealDB version
2.0.0 beta linux
surrealdb.py version
0.3.2
Contact Details
No response
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: