This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-25
Channels
- # announcements (10)
- # babashka (21)
- # calva (8)
- # cider (6)
- # clj-commons (5)
- # clj-kondo (37)
- # cljfx (16)
- # clojure (31)
- # clojure-australia (1)
- # clojure-europe (7)
- # conjure (8)
- # cursive (3)
- # data-science (4)
- # datalevin (6)
- # datomic (18)
- # emacs (10)
- # holy-lambda (3)
- # honeysql (4)
- # humbleui (1)
- # introduce-yourself (1)
- # lsp (13)
- # malli (6)
- # portal (8)
- # scittle (5)
- # specter (1)
- # vscode (9)
- # xtdb (5)
this works fine:
(def treefrog-sample-data
[{:treefrog/latin-name "Bix"
:treefrog/common-name "Bax"
:treefrog/nickname "Bob"
:xt/id (java.util.UUID/randomUUID)}
{:treefrog/latin-name "Biz"
:treefrog/common-name "Baz"
:treefrog/nickname "Joe"
:xt/id (java.util.UUID/randomUUID)}])
(xt/submit-tx thenode
(for [doc treefrog-sample-data]
[:xtdb.api/put doc]))
but this:
(xt/submit-tx thenode
[:xtdb.api/put
{:treefrog/latin-name “Bix”
:treefrog/common-name “Bax”
:treefrog/nickname “Bob”
:xt/id (java.util.UUID/randomUUID)}])
produces:
1. Unhandled java.lang.IllegalArgumentException
Don’t know how to create ISeq from: clojure.lang.Keyword
RT.java: 557 clojure.lang.RT/seqFrom
RT.java: 537 clojure.lang.RT/seq
core.clj: 139 clojure.core/seq
core.clj: 2750 clojure.core/map/fn
What am I missing?
UPDATE: this works (with the double square brackets)...
(xt/submit-tx thenode
[[:xtdb.api/put
{:treefrog/latin-name "Bix"
:treefrog/common-name "Bax"
:treefrog/nickname "Bob"
:xt/id (java.util.UUID/randomUUID)}]])
but I could use a bit more understanding here.
our messages just crossed… I had just updated my question as you posted your answer… thank you!
😄 1
🙏 1
> but I could use a bit more understanding here
It's because each a transaction is a vector of operations, and each operation is itself a vector (`[:xtdb.api/put {...}]`). So if you call (xt/submit-tx node [:xtdb.api/put {...}])
, xt thinks that :xtdb.api/put
is an operation by itself. i.e. it expects to get a vector, but in fact gets a keyword, hence the Don't know how to create ISeq from: clojure.lang.Keyword
message.
🙏 1
Ah, gotcha now. This is helpful. 👍🙂