Fork me on GitHub
Godwin Ko00:07:30

hi all, a newbie of xtdb exploring its potential, just wanna ask how can I submit a timestamp attribute through http client? afaik JSON encode timestamp as string, causing the attribute value changed to string format 😅


Hey @ULS5BHEUR the HTTP server also supports application/edn and application/transit+json as content types, which should preserve various types end-to-end. Have you observed some unwanted coercion?

Godwin Ko11:07:31

Haven't tried transit before, will take a look, thx for pointing me the way to explore 🙏:skin-tone-2:

Godwin Ko11:07:56

My requirement is integrating xtdb with a Ruby app, that's why can't use any of the Clojure client 😅

👍 1

maybe JRuby + interop is an option...? 😅

Godwin Ko12:07:06

I’d like to go that path if I can, but fixing gems compatibility is much more troublesome than using plain http api call to xtdb 😜

💯 1
Godwin Ko12:07:18

we also have another option to use rpc call through the message broker, but for prove of concept prototype, http api is good enough at the moment 🤞:skin-tone-2:

👍 1
Godwin Ko15:07:09

when I switch to post using transit body, I keep getting the invalid-tx-op error from the server the exact same body param post using json is fine, absolutely no clue what’s missing :thinking_face: > { > “errorKey”: “invalid-tx-op”, > “errorType”: “illegal-argument”, > “message”: “invalid tx-op: Invalid tx op”, > “op”: [ > “put”, > { > “name”: “testing”, > “xt/id”: “testing” > } > ] > }

Godwin Ko16:07:25

oh I finally figure out why, when I use transit+json, the encoding body must use edn syntax instead, with put replaced by :xtdb.api/put etc 🤞:skin-tone-2:

🎉 1

Ah yep, that'll do it 🙂

Godwin Ko11:07:18

One more question regarding the internal storage of a doc, if a put tx on an existing :xt/id with only few attribute/value changed, will all the historical copy of docs stored in db? Or there's a mechanism to keep the diff only? :thinking_face:


The doc-store always stores documents as-is (though hypothetically a doc-store implementation could perform diffing under the hood - none do today), but most things in the local KV indexes on the node are deduplicated already, at least for top-level AVs. Changes to deeply nested values don't get processed as diffs, but might still benefit from RocksDB compression


Has anyone done a write up on feature comparison of datomic and XTDB, link ?


Hey @U0J3J79FE In case you've not spotted this already - it isn't particularly detailed, and is probably worthy of refreshing, but hopefully is of some use:

👍 1