This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-01
Channels
- # announcements (20)
- # babashka (3)
- # beginners (30)
- # calva (28)
- # cider (3)
- # circleci (4)
- # clerk (27)
- # clj-kondo (72)
- # cljdoc (15)
- # cljs-dev (1)
- # clojure (85)
- # clojure-europe (37)
- # clojure-nl (1)
- # clojure-norway (13)
- # clojure-spec (7)
- # clojurescript (19)
- # clr (1)
- # conjure (11)
- # datahike (2)
- # datomic (11)
- # emacs (26)
- # events (4)
- # hoplon (35)
- # hyperfiddle (41)
- # jobs (7)
- # lsp (10)
- # nrepl (3)
- # off-topic (57)
- # portal (47)
- # practicalli (1)
- # rdf (3)
- # reitit (21)
- # releases (1)
- # testing (6)
- # tools-build (16)
- # wasm (1)
- # xtdb (16)
Hi! Trying out xtdb2, using https://www.xtdb.com/v2, using the jvm-opts as described and calling:
(require '[xtdb.client :as xt.client]
'[xtdb.api :as xt])
(def my-node (xt.client/start-client ""))
(xt/status my-node)
I'm getting a java.util.concurrent.ExecutionException
(full exception in ๐งต).
I'm on Windows and jdk19
EDIT: I think I realized what I'm doing wrong, brbHere's the full exeception
#error {
:cause nil
:via
[{:type java.util.concurrent.ExecutionException
:message "java.net.ConnectException"
:at [java.util.concurrent.CompletableFuture reportGet "CompletableFuture.java" 396]}
{:type java.net.ConnectException
:message nil
:at [jdk.internal.net.http.common.Utils toConnectException "Utils.java" 1045]}
{:type java.nio.channels.ClosedChannelException
:message nil
:at [sun.nio.ch.SocketChannelImpl ensureOpen "SocketChannelImpl.java" 202]}]
:trace
[[sun.nio.ch.SocketChannelImpl ensureOpen "SocketChannelImpl.java" 202]
[sun.nio.ch.SocketChannelImpl beginConnect "SocketChannelImpl.java" 786]
[sun.nio.ch.SocketChannelImpl connect "SocketChannelImpl.java" 874]
[jdk.internal.net.http.PlainHttpConnection lambda$connectAsync$1 "PlainHttpConnection.java" 208]
[java.security.AccessController doPrivileged "AccessController.java" 569]
[jdk.internal.net.http.PlainHttpConnection connectAsync "PlainHttpConnection.java" 210]
[jdk.internal.net.http.PlainHttpConnection checkRetryConnect "PlainHttpConnection.java" 259]
[jdk.internal.net.http.PlainHttpConnection lambda$connectAsync$2 "PlainHttpConnection.java" 235]
[java.util.concurrent.CompletableFuture uniHandle "CompletableFuture.java" 934]
[java.util.concurrent.CompletableFuture$UniHandle tryFire "CompletableFuture.java" 911]
[java.util.concurrent.CompletableFuture postComplete "CompletableFuture.java" 510]
[java.util.concurrent.CompletableFuture$AsyncSupply run "CompletableFuture.java" 1773]
[java.util.concurrent.ThreadPoolExecutor runWorker "ThreadPoolExecutor.java" 1144]
[java.util.concurrent.ThreadPoolExecutor$Worker run "ThreadPoolExecutor.java" 642]
[java.lang.Thread run "Thread.java" 1589]]}
Ok I think I was confused by the second step:
Connect
Via either (1) HTTP Clojure client driver, (2) experimental SQL-only pgwire-server compatibility, or (3) use the embedded node started via your Clojure REPL (i.e. skip this step)
I wanted to just start a minimal in-memory node without postgres or anything.
For that I just found that calling
(def node (xt.node/start-node {}))
and using xt/submit-tx
and xt/q
on that node object workedThough now I realize that the docs there don't cover that usage and are just explaining that you can use the node "server" object directly or the client object
hey @U064UGEUQ - yep, guide for the in-process node is https://www.xtdb.com/reference/main/installation#_in_process ๐
there's a filesystem durable tx-log and object-store, although these are only suitable from being used by a single node
in xtdb2 is there a way to match on an array within a document containing a certain value?
(xt/submit-tx node
[[:put :things
{:xt/id "1"
:name "thing1"
:colors ["red" "green" "blue"]}]
[:put :things
{:xt/id "2"
:name "thing2"
:colors ["yellow"]}]])
;;; I want all the things with "blue" as a color
(xt/q node
'{:find [colors]
:where
[($ :things [{:colors colors}])
;; failed attempts:
;;[(some #{"blue"} colors)]
;;[(= colors "blue")]
]
})
we haven't yet added significant support for nested data structures to the Datalog language I'm afraid ๐ญ
Do you know if it's possible with SQL queries? I don't have experience with arrays in sql, but I'm not having any luck with variations on these https://stackoverflow.com/q/39643454
(xt/q node ["SELECT things.colors FROM things where ? = ANY(things.colors)" "blue"]
{:default-all-valid-time? true})
Invalid SQL query:
- Column reference is not a grouping column: things.colors at line 1, column 8
- WHERE clause cannot contain aggregate functions: ANY(things.colors) at line 1, column 44
again, not as yet I'm afraid - we've added support for nested data to the underlying query engine but not yet to the high-level languages