This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-14
Channels
- # announcements (1)
- # asami (3)
- # aws (1)
- # babashka (22)
- # beginners (39)
- # calva (21)
- # clj-kondo (10)
- # cljdoc (22)
- # cljs-dev (17)
- # clojure (93)
- # clojure-australia (3)
- # clojure-europe (39)
- # clojure-italy (3)
- # clojure-losangeles (17)
- # clojure-nl (14)
- # clojure-russia (2)
- # clojure-uk (5)
- # clojurescript (35)
- # community-development (7)
- # conjure (2)
- # cursive (13)
- # data-science (1)
- # datomic (25)
- # emacs (5)
- # events (4)
- # figwheel-main (2)
- # fulcro (12)
- # graphql (7)
- # gratitude (2)
- # inf-clojure (6)
- # leiningen (6)
- # lsp (49)
- # malli (13)
- # membrane (30)
- # minecraft (1)
- # pathom (3)
- # pedestal (26)
- # polylith (13)
- # portal (2)
- # quil (3)
- # random (1)
- # re-frame (13)
- # reagent (43)
- # reitit (6)
- # releases (1)
- # reveal (2)
- # ring (3)
- # shadow-cljs (30)
- # specter (5)
- # sql (8)
- # tools-build (1)
- # tools-deps (13)
- # videos (1)
I am occasionally getting some really long :kv-cluster/get-val
read times, such as
DEBUG {:event :kv-cluster/get-val, :val-key "60a5e1e2-b81a-49a1-9161-b19df11c3934", :msec 965000.0, :phase :end, :pid 26, :tid 190}
Why would this happen? What could explain this?
Zero services, other than datomic backend, have problem reading from postgres.
This is on-prem and the storage is postgres.This query fails to run. It fails to marshal because it contains a regex.
Execution error at com.cognitect.transit.impl.AbstractEmitter/marshal (AbstractEmitter.java:194).
Not supported: class java.util.regex.Pattern
Can we add a transit handler for Datomic to successfully marshal and unmarshal the regex?
Or is there a simpler solution?
If I'm right: • This works fine in dev-local and when the app is deployed as an Ion inside the Datomic Cloud cluster. No marshalling is required in such environments. • But it doesn't work when the app runs outside the cluster and connects remotely to a DB. Marshalling is required in such environments.
Can you pass the regex as string, then use re-pattern to compile?
Although the regex api is a bit imperative, wonder how that goes…
(Note that you can’t do nested exprs, you need to bind single exprs one by one)
@UDF11HLKC that's something I tried, but no, we can't. Even a hardcoded search term like this one makes it throw the same error.
'[:find (pull ?cpl cpl-repres)
:in $ cpl-repres ?tenant-id ?search-str
:where [?tenant :tenant/name ?name]
[(.toLowerCase ^String ?name) ?lower-name]
[(re-find #"(?i)si" ?lower-name)]
...]
Or, for sure, we could install a transaction function just for the purpose of instantiating a regex pattern "server-side" out of args passed as strings, but again, is there a simpler solution or a config knob for transit handlers? Edit: oh no, a tx-fn isn't a solution since this is a query...
I meant constructing the pattern inside the clauses of the query:
(d/q '{:find [?match]
:in [$ ?pattern-string ?input]
:where [[(re-pattern ?pattern-string) ?pattern]
[(re-find ?pattern ?input) ?match]]}
(d/db conn)
"\\d+"
"abc12345def")
=> #{["12345"]}
although this is all in-process, so YMMV
@UDF11HLKC, this does indeed seem to work! Thanks a lot for taking the time to come back!
Yeah, so pattern instances can’t be serialized, and we circumvent that by passing a string and compiling the pattern on the peer. You have access to the majority of clojure.core on the peer, after all
I am new to datomic and I am doing self running , going through https://docs.datomic.com/cloud/dev-local.html and I installed it and configured local storage
(ns datomic-practice.core
(:require [datomic.client.api :as d]))
(def client (d/client {:server-type :dev-local
:system "datomic-samples"}))
(println (d/list-databases client {}))
Unzip the datomic-samples zip into your - i have completed this step and ran ./install
And it's content is
{:storage-dir "/home/g/SOME-FOLDER"}
and you have unzipped the samples into
"/home/g/SOME-FOLDER/datomic-samples"
Or, for sure, we could install a transaction function just for the purpose of instantiating a regex pattern "server-side" out of args passed as strings, but again, is there a simpler solution or a config knob for transit handlers? Edit: oh no, a tx-fn isn't a solution since this is a query...