This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-06
Channels
- # announcements (12)
- # babashka (34)
- # beginners (85)
- # calva (76)
- # cider (14)
- # clj-kondo (49)
- # cljs-dev (32)
- # clojure (418)
- # clojure-europe (3)
- # clojure-france (4)
- # clojure-italy (17)
- # clojure-losangeles (8)
- # clojure-nl (5)
- # clojure-norway (2)
- # clojure-spec (2)
- # clojure-uk (88)
- # clojuredesign-podcast (4)
- # clojurescript (49)
- # clojurex (75)
- # clr (2)
- # core-async (13)
- # cursive (6)
- # datomic (57)
- # duct (31)
- # emacs (6)
- # fulcro (25)
- # graalvm (67)
- # graphql (13)
- # hoplon (1)
- # java (6)
- # juxt (11)
- # kaocha (5)
- # keechma (2)
- # leiningen (16)
- # mount (1)
- # off-topic (19)
- # pathom (2)
- # pedestal (1)
- # re-frame (11)
- # reagent (21)
- # reitit (22)
- # rewrite-clj (1)
- # shadow-cljs (98)
- # spacemacs (5)
- # sql (16)
- # tools-deps (8)
- # vim (28)
- # xtdb (4)
Anyone run into this? This is what happens when my application (running in EKS) tries to connect to my datomic cloud. Datomic cloud is working fine, tested it with the proxy. I already double checked that the EndpointAddress is correct in my cloud formation stack
{:type clojure.lang.ExceptionInfo
:message Unable to connect to .<stack_name>.
:data {:cognitect.anomalies/category :cognitect.anomalies/not-found, :cognitect.anomalies/message entry.<stack-name>.: Name does not resolve, :config {:server-type :cloud, :region us-west-2, :system <system-name>, :endpoint .<stack-name>., :endpoint-map {:headers {host entry.<stack-name>.}, :scheme http, :server-name entry.<stack-name>., :server-port 8182}}}
:at [datomic.client.impl.cloud$get_s3_auth_path invokeStatic cloud.clj 178]}]
Using on-prem I'm looking to generate a tempid then use it to find the real-eid from the :tempids
map that is returned from transact!
. A generated tempid looks like {:part :db.part/user, :idx -1000305}
. It would make sense to me if instead it was a negative number of 19 digits length, because the :tempids
map keys are all 19 digit negatives. Can someone help with the error in my understanding? Thx.
you can use strings as tempids even with the on-prem version of datomic.
is there any specific reason for using the d/tempid
function?
Err no - I somehow must have just come across it and thought that was the way to generate 'the next tempid'. I can just use gensym I guess. How do people normally generate tempid strings?
i have the feeling that u might not even need to generate if you don't care about what the tempids are.
it's not necessary to explicitly specify a tempid anymore, UNLESS you want to reference a newly transacted (or modified) entity in another fact/entity within the same txn
also, tempid strings only have to be uniq within a transaction, so you can simply number them with range
maybe if u can share more specifics about your use-case, then we can help easier. im working on some tsv import code now and trying to write tests for it. it looks something like this:
(defn mk-rule [n]
(let [rule-expr (str "rule-" (if (keyword? n) (name n) n))]
{:db/ident (keyword rule-expr)
:rule/algo :regex
:rule/expr rule-expr}))
(deftest re-import-rules
(testing "remove rule"
(tx [(mk-rule :to-be-deleted)
(mk-rule :unchanged)])
(is (= #{:rule-to-be-deleted
:rule-unchanged}
(q '[:find (set ?r-ident) .
:where
[?r :rule/algo+expr]
[(datomic.api/ident $ ?r) ?r-ident]])))))
note how i just made up a convention of identifying my temporary rule entities with a rule-
prefix
in another test, i just made up a bunch of rules and simply numbered, like this:
(tx (map mk-rule (range 10)))
then i could create an entity referencing them, like this:
(tx [{:txn/id 1
:txn/matching-rule [:rule-2 :rule-3]}])
im using db/ident
s here, so i don't have to fuss around with tempid resolution, since im working on an in-memory db, but the naming principle is the same...also, if u use nested entity maps in tx-data, then the assignment of the nested entity ids to the containing entity's ref attribute is done automatically by the d/transact
logic
This is a Fulcro application. The idea is that there are fulcro-tempids on client. They get sent to the server. The idea is to generate datomic tempids to go with them as pairs in a map. (key will be Fulcro, val will be datomic tempid). After transact! get two maps. Can use them to get a map of fulcro-tempid -> real-eid. The client can then use that map to do the remapping of the client state.
i've also noticed that u were talking about transact!
.
that's an old function, if i understood correctly.
the current https://docs.datomic.com/on-prem/clojure/index.html documentation doesn't even mention it anymore. it just simply uses transact
because writing more code which is not necessary when using newer datomic feels like unnecessary pain
that seems like a recent enough version though to support string tempids and transact
without a bang
(i also just noticed this change a few days ago, when coming back to datomic after 2-3 years ;)
so it sounds like you dont need a fulcro-tempid -> datomic-tempid because the fulcro-tempid can be just a string and u can use that directly in your tx-data
Yes that's what I thought too, as long as it is a string, which I can convert it to if its not.
Well back on the client, in client state, there are client tempids (yes "fulcro-tempids").
and what is that TempId
?
which namespace is it from for example?
but i guess i can't add more to this topic now.
i have to get back to work too.
The problem is already solved in my mind, doing as you say, using 'fulcro-tempid' as the tempids to datomic. String conversion not really an issue.
Using Datomic Cloud I have an entity with a :tags attribute with a :db.type/keyword
with :cardinality/many
. The allowed keywords are :a :b :c :d :e
and any combination of those keywords is allowed as the value of the :tags attribute.
Now I want to update the value of :tags with a new combination of those keywords. How can I say "remove current values of :tags and add these new values"?
I could d/pull
on the entity to pull back it's tags and then retract them one by one but that seems like the wrong way
you want it to be atomic -- if you read then transact you'll have a race @brian.rogers
another possibility is to avoid the race is to do a CAS then retry https://docs.datomic.com/cloud/best.html#optimistic-concurrency
:tags/version 4
then send in [:db/cas entity :tags/version 4 5]
alongside your asserts+retracts
@marshall Is this documentation still up to date? https://docs.datomic.com/cloud/operation/client-applications.html#create-endpoint I don't see "LoadBalancerName" in my Datomic CloudFormation Output section. I'm using a Solo topology. Look like one can't connect using this method for a solo topology. Do I have to do VPC peering for solo?
Accessing Datomic from a separate VPC in versions older than 388 only can be achieved with VPC Peering
Well I'm on the latest version so this seems out of the question too. What am I supposed to do?
Just tried adding my EKS VPC to the private datomic route 53 hosted zone, no dice on that either
Does anyone know where VpcEndpointDns
is? https://docs.datomic.com/cloud/operation/client-applications.html