This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-28
Channels
- # asami (1)
- # aws (9)
- # babashka (16)
- # beginners (32)
- # calva (2)
- # clj-kondo (20)
- # cljdoc (6)
- # clojure (35)
- # clojure-dev (25)
- # clojure-europe (11)
- # clojure-india (1)
- # clojure-norway (2)
- # clojure-spec (26)
- # clojure-uk (1)
- # clojurescript (41)
- # conjure (3)
- # css (9)
- # cursive (18)
- # data-oriented-programming (6)
- # data-science (2)
- # emacs (47)
- # events (1)
- # fulcro (15)
- # graalvm (30)
- # gratitude (7)
- # honeysql (27)
- # inf-clojure (4)
- # introduce-yourself (2)
- # lsp (129)
- # malli (7)
- # missionary (21)
- # nbb (17)
- # off-topic (18)
- # re-frame (6)
- # releases (1)
- # shadow-cljs (120)
- # vim (7)
- # xtdb (15)
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?
Haven't tried transit before, will take a look, thx for pointing me the way to explore 🙏:skin-tone-2:
no problem! for reference, the xtdb-http-client module uses application/edn
https://github.com/xtdb/xtdb/blob/7e9c5bf1e62f9f34060065885d9eadf0fe5c4888/modules/http-client/src/xtdb/remote_api_client.clj#L84
My requirement is integrating xtdb with a Ruby app, that's why can't use any of the Clojure client 😅
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 😜
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:
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”
> }
> ]
> }
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:
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
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: https://docs.xtdb.com/resources/faq/#comparisons