This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-25
Channels
- # announcements (3)
- # aws (6)
- # beginners (143)
- # boot (14)
- # calva (2)
- # cider (1)
- # clara (1)
- # clj-kondo (1)
- # cljdoc (4)
- # cljs-dev (50)
- # cljsrn (5)
- # clojure (61)
- # clojure-chicago (1)
- # clojure-europe (4)
- # clojure-italy (5)
- # clojure-nl (5)
- # clojure-spec (32)
- # clojure-uk (11)
- # clojurescript (166)
- # clojureverse-ops (2)
- # clr (3)
- # core-typed (1)
- # cursive (8)
- # datomic (21)
- # defnpodcast (1)
- # emacs (1)
- # figwheel (1)
- # figwheel-main (1)
- # fulcro (7)
- # graphql (7)
- # jobs (8)
- # leiningen (4)
- # luminus (3)
- # lumo (17)
- # mount (3)
- # nrepl (4)
- # off-topic (113)
- # pedestal (1)
- # re-frame (15)
- # reagent (2)
- # reitit (2)
- # shadow-cljs (75)
- # spacemacs (3)
- # sql (12)
- # tools-deps (44)
- # uncomplicate (2)
- # xtdb (15)
@joe.lane Throwing would work but why can't you detect that your tx is empty and not send it to the transactor in the first place?
I have a datomic cloud database with a bunch of {:db/ident :loc/gb}
{:db/ident :loc/us}
etc... used as enumerable values. How can I find out all available values in the :loc namespace that are available in the db? i.e. I want to find all countries in the existing schema.
I think
(d/q '[:find [?attr ...]
:in $
:where
[?e :db/ident ?attr]
[(datomic.Util/namespace ?attr) ?ns]
[(= ?ns "loc")]]
(d/db conn))
will do the jobOh, sorry, I'm not familiar with cloud. Maybe someone else is... Would this work: ?
(->> (d/q '[:find [?ident ...]
:in $
:where
[?e :db/ident ?ident]]
(d/db conn))
(filter #(= "loc" (namespace %))))
No problem
Cloud does indeed support db functions if you prefer that route: https://docs.datomic.com/cloud/query/query-data-reference.html#deploying
fwiw, I like @U09R86PA4’s approach 🙂
Great question @me1740, I’m hoping to write a single transaction function which will either return nothing to transact or some data to update. The advantage here is leveraging the transactor for its atomicity. In the case where there is nothing to transact I’d like to avoid creating an empty transaction entity. Having nothing to transact is the common path. The whole reason for the question is to avoid increasing the number of datoms in the system with empty transaction entities. It’s a system with n timers firing once per second, where N could scale to thousands (eventually). The callback attached to each timer will check a predicate and, if true, will transact some new state into datomic, if false, it should do nothing. I could augment this system to have a single timer that checks the predicate against all candidate entities, but that runs the risk of overrunning the 1 second timer (eventually) if the number of candidate entities grows large (may not be problematic in practice, need to measure). Throwing to avoid an extra transaction datom may work, but I worry about exception throwing as flow control slowing the transactor down (transactions are notorious perf killers on the jvm), ESPECIALLY since having nothing to transact is the normal case, not the exceptional case.
I am trying to run d/sync on client and getting
IllegalArgumentException No implementation of method: :sync of protocol: #'datomic.client.api/Connection found for class: datomic.client.impl.shared.Connection clojure.core/-cache-protocol-fn (core_deftype.clj:583)
client is com.datomic/client-pro "0.8.17"