datetime
is not meant for web3 but needs a Tableland alternative
#280
dtbuchholz
started this conversation in
General
Replies: 1 comment 1 reply
-
An additional (bit more work) option would be to map "now" to block.datetime or similar. This would require some backend work and likely updates to the AST/Parser, but should it come up again in the future, might be a nice compromise. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
User Story
I'm a developer who wants to insert values into a table with the latest timestamp, e.g.,
datetime('now')
. However, Tableland SQL does not support this, which reduces SQL parity and increases friction.Ideas
Create a Tableland-native SQL function called
TBL_DATETIME()
(or along those lines, likeBLOCK_TIMESTAMP()
) that would "magically":block.number
(and/or maybetx.hash
) into a cell. This information already exists in the emitted events that validators process. But, this means devs have to do extra work to get the timestamp (i.e., the API call in the point above), which is the reason for wantingdatetime
in the first place. The SDK / CLI would be able to add this extra processing step as a feature, though, so maybe it's not the worst case -- but only offeringblock.number
feels more like a different feature.Additional Information
Briefly discussed on Discord here and related to a non-deterministic use case discovered here
Beta Was this translation helpful? Give feedback.
All reactions