This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-07
Channels
- # announcements (1)
- # babashka (31)
- # beginners (54)
- # biff (3)
- # calva (22)
- # cider (13)
- # circleci (1)
- # clj-kondo (6)
- # cljsrn (2)
- # clojure (113)
- # clojure-europe (58)
- # clojure-mexico (5)
- # clojure-nl (3)
- # clojure-uk (7)
- # clojurescript (81)
- # cursive (20)
- # datomic (33)
- # events (3)
- # fulcro (29)
- # introduce-yourself (1)
- # meander (78)
- # off-topic (60)
- # om-next (2)
- # podcasts-discuss (1)
- # re-frame (8)
- # reagent (5)
- # reitit (20)
- # remote-jobs (1)
- # shadow-cljs (24)
- # spacemacs (10)
- # sql (8)
- # tools-deps (22)
- # xtdb (16)
#client Why this query returns nothing
(count (d/q
'[:find (pull ?e [*])
:where
[?e _ #uuid"ca92f40a-998b-5fef-96c0-7a3074c55ab1"]]
db))
=> 0
and this query find the entity?
(count (d/q
'[:find (pull ?e [*])
:where
[?a :db/ident]
[?e ?a #uuid"ca92f40a-998b-5fef-96c0-7a3074c55ab1"]]
db))
=> 1
This behavior feels wrong to meSo it should throw an exception, right?! I remember to get "full database scan" in peer api
https://ask.datomic.com/index.php/644/datomic-returns-results-insufficient-bindings-exception
The client api will throw "full database scan" errors too btw; just not in this example.
where order matter: In "devtime", I was trying to find "all attributes that point into an entity"
(d/q '[:find ?ident
:where
[?a :db/ident ?ident]
[?x ?a ?e]
[?e :user/id]]
db)
Execution error (IllegalArgumentException) at datomic.core.datalog/resolve-id (datalog.clj:330).
Cannot resolve key: Sun Jun 13 05:00:44 BRT 2021
(d/q '[:find ?ident
:where
[?a :db/ident ?ident]
[?e :user/id]
[?x ?a ?e]]
db)
=> [[:a] [:b] [:c]]
Is it a know issue? Should I report at http://ask.datomic.com?are you trying to figure out which attributes are refs? because ref attributes point to entities
[?attr :db/ident ?ident]
[?attr :db/valueType :db.valueType/ref]
or are you asking about which attribute entities have refs pointing to other entities?(because attributes are defined in datomic as ordinary entities, and they can have arbitrary facts asserted about those entities)
My original problem was "or are you asking about which attribute entities have refs pointing to other entities?"
But I'm not reporting this. I already solved my problem.
I'm reporting ":where order may change the results of the query"
As far I know, by design, change the :where
order should only affect the performance, right?!
it is not clear what happened in your first query. The error doesn't seem to correlate to the query
Yes, related
Datomic find all ?a
for each ?a, find ?x and ?e
once ?e is used as a id
at [?e :user/id]
, datomic tries to call resolve-id
in ?e
But ?e
is an instant/date
Execution error (IllegalArgumentException) at datomic.core.datalog/resolve-id (datalog.clj:330).
Cannot resolve key: Sun Jun 13 05:00:44 BRT 2021
*e
=>
#error{:cause "Cannot resolve key: Sun Jun 13 05:00:44 BRT 2021",
:via [{:type clojure.lang.ExceptionInfo,
:message "processing clause: [?e :cs.model.monitored.machine-type/id], message: Cannot resolve key: Sun Jun 13 05:00:44 BRT 2021",
:data #:cognitect.anomalies{:category :cognitect.anomalies/incorrect,
:message "processing clause: [?e :cs.model.monitored.machine-type/id], message: Cannot resolve key: Sun Jun 13 05:00:44 BRT 2021"},
:at [datomic.core.datalog$throw_query_ex_BANG_ invokeStatic "datalog.clj" 50]}
{:type java.lang.IllegalArgumentException,
:message "Cannot resolve key: Sun Jun 13 05:00:44 BRT 2021",
:at [datomic.core.datalog$resolve_id invokeStatic "datalog.clj" 330]}],
:trace [[datomic.core.datalog$resolve_id invokeStatic "datalog.clj" 330]
[datomic.core.datalog$resolve_id invoke "datalog.clj" 327]
[datomic.core.datalog$fn__22911$bind__22923 invoke "datalog.clj" 442]
[datomic.core.datalog$fn__22911 invokeStatic "datalog.clj" 619]
[datomic.core.datalog$fn__22911 invoke "datalog.clj" 399]
[datomic.core.datalog$fn__22761$G__22735__22776 invoke "datalog.clj" 119]
[datomic.core.datalog$join_project_coll invokeStatic "datalog.clj" 184]
[datomic.core.datalog$join_project_coll invoke "datalog.clj" 182]
[datomic.core.datalog$fn__22834 invokeStatic "datalog.clj" 289]
[datomic.core.datalog$fn__22834 invoke "datalog.clj" 285]
[datomic.core.datalog$fn__22740$G__22733__22755 invoke "datalog.clj" 119]
[datomic.core.datalog$eval_clause$fn__23495 invoke "datalog.clj" 1460]
[datomic.core.datalog$eval_clause invokeStatic "datalog.clj" 1455]
[datomic.core.datalog$eval_clause invoke "datalog.clj" 1421]
[datomic.core.datalog$eval_rule$fn__23527 invoke "datalog.clj" 1541]
[datomic.core.datalog$eval_rule invokeStatic "datalog.clj" 1526]
[datomic.core.datalog$eval_rule invoke "datalog.clj" 1505]
[datomic.core.datalog$eval_query invokeStatic "datalog.clj" 1569]
[datomic.core.datalog$eval_query invoke "datalog.clj" 1552]
[datomic.core.datalog$qsqr invokeStatic "datalog.clj" 1658]
[datomic.core.datalog$qsqr invoke "datalog.clj" 1597]
[datomic.core.datalog$qsqr invokeStatic "datalog.clj" 1615]
[datomic.core.datalog$qsqr invoke "datalog.clj" 1597]
[datomic.core.query$q_STAR_ invokeStatic "query.clj" 619]
[datomic.core.query$q_STAR_ invoke "query.clj" 606]
[datomic.core.local_query$local_q invokeStatic "local_query.clj" 58]
[datomic.core.local_query$local_q invoke "local_query.clj" 52]
[datomic.core.local_db$fn__25618 invokeStatic "local_db.clj" 28]
[datomic.core.local_db$fn__25618 invoke "local_db.clj" 24]
[datomic.client.api.impl$fn__11642$G__11635__11649 invoke "impl.clj" 41]
[datomic.client.api.impl$call_q invokeStatic "impl.clj" 150]
[datomic.client.api.impl$call_q invoke "impl.clj" 147]
[datomic.client.api$q invokeStatic "api.clj" 393]
[datomic.client.api$q invoke "api.clj" 365]
[datomic.client.api$q invokeStatic "api.clj" 395]
[datomic.client.api$q doInvoke "api.clj" 365]
[clojure.lang.RestFn invoke "RestFn.java" 423]
(let [hello {:server-type :dev-local :system "hello" :db-name "hello"}
conn (-> (d/client hello)
(doto (d/create-database hello))
(d/connect hello))
tx-schema [{:db/ident :user/id
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}
{:db/ident :address/user
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one}]
{:keys [db-after]} (d/transact conn {:tx-data tx-schema})
{:keys [db-after]} (d/transact conn {:tx-data [{:db/id "a"
:user/id "a"}
{:address/user "a"}]})]
(d/q '[:find ?ident
:where
[?a :db/ident ?ident]
[?x ?a ?e]
[?e :user/id]]
db-after))
Sometimes throw by date, sometimes by string
Execution error (IllegalArgumentException) at datomic.core.datalog/resolve-id (datalog.clj:330).
Cannot resolve key: Retract all facts about an entity, including references from other entities and component attributes recursively.
Is it possible to run datomic inside a docker-compose? Everything seems to work fine, except my clojure app cannot seem to access datomic:
is port 4335 open also? The dev storage is special because it’s also acting as storage (h2 sql) on port 4335.
If the clojure app is also running in a container, localhost won't work. You'll need to use the name of the running container, as well as place both on the same bridge network. No need to export the ports in this case either, fyi
re posting my question here in case something jumps out at anyone 🙂 My next step is to ... re-read the docs again? Then flush out the websocket functionality more, as i worry that my mock/toy example might be complicating things rather then simplifying them. https://forum.datomic.com/t/where-do-i-view-output-of-datomic-ion-cast-alert/1892
Hey @drewverlee, a couple of things right off the bat:
• https://docs.datomic.com/cloud/operation/monitoring.html#searching-cloudwatch-logs-aws for viewing the cloudwatch logs for your solo system. The log group should be called datomic-{name-of-your-system}
• Per the https://docs.datomic.com/cloud/ions/ions-reference.html#entry-points table, Lambda ions MUST return either a String, InputStream, ByteBuffer, or File. Cast functions don't return any of those.
• I don't think you want to cast an alert, I think you want https://docs.datomic.com/cloud/ions/ions-monitoring.html#events. Also, custom metrics are not supported in solo (to keep the cost down).
• Your alert would not show up in the lambda logs, those have a completely separate log group than your system.
• You are on the right track!
Hey @drewverlee, a couple of things right off the bat:
• https://docs.datomic.com/cloud/operation/monitoring.html#searching-cloudwatch-logs-aws for viewing the cloudwatch logs for your solo system. The log group should be called datomic-{name-of-your-system}
• Per the https://docs.datomic.com/cloud/ions/ions-reference.html#entry-points table, Lambda ions MUST return either a String, InputStream, ByteBuffer, or File. Cast functions don't return any of those.
• I don't think you want to cast an alert, I think you want https://docs.datomic.com/cloud/ions/ions-monitoring.html#events. Also, custom metrics are not supported in solo (to keep the cost down).
• Your alert would not show up in the lambda logs, those have a completely separate log group than your system.
• You are on the right track!
> Your alert would not show up in the lambda logs, those have a completely separate log group than your system. Ah, this is the issue.