In on-prem (maybe also on client) you should use the :tempids
key in the transaction result, there and use datomic.api/resolve-tempid
to resolve the tempids to realized entity-ids.
we have upgraded clojure cli tools x.x.x.590
to 1.10.1.697
, then the following error appeared:
$ clj -Srepro -e "(require 'datomic.client.api)"
WARNING: When invoking clojure.main, use -M
Execution error (FileNotFoundException) at clojure.core.async.impl.ioc-macros/eval774$loading (ioc_macros.clj:12).
Could not locate clojure/tools/analyzer__init.class, clojure/tools/analyzer.clj or clojure/tools/analyzer.cljc on classpath.
i think im on the latest dependencies in my ./deps.edn
file:
org.clojure/clojure {:mvn/version "1.10.1"}
com.datomic/client-cloud {:mvn/version "0.8.102"}
com.datomic/ion {:mvn/version "0.9.48"}
I tried it with both nixpkgs.jdk8 and jdk11. I tried it with and without the deps overrides recommended by the latest ion-dev push operation. the error is always the same. I have no other dependencies specified and still get this error. I guess I can specify this missing dependecy explicitly, but it feels like I'm doing something wrong, if such a bare bones ion project doesn't work out of the box.
Can you share your full deps.edn?
{:paths
["src" ;"rsc" "classes"
]
:deps
{
org.clojure/clojure {:mvn/version "1.10.1"}
com.datomic/client-cloud {:mvn/version "0.8.102"}
com.datomic/ion {:mvn/version "0.9.48"}
;org.clojure/data.json {:mvn/version "0.2.6"}
;http-kit/http-kit {:mvn/version "2.5.0"}
;metosin/reitit-ring {:mvn/version "0.5.6"}
;org.clojure/tools.analyzer {:mvn/version "1.0.0"}
;; Deps to avoid conflicts with Datomic Cloud
;; commons-codec/commons-codec #:mvn{:version "1.13"},
;; com.fasterxml.jackson.core/jackson-core #:mvn{:version "2.10.1"},
;; com.amazonaws/aws-java-sdk-core #:mvn{:version "1.11.826"},
;; com.cognitect/transit-clj #:mvn{:version "0.8.319"},
;; com.cognitect/s3-creds #:mvn{:version "0.1.23"},
;; com.amazonaws/aws-java-sdk-kms #:mvn{:version "1.11.826"},
;; com.amazonaws/aws-java-sdk-s3 #:mvn{:version "1.11.826"}
}
:mvn/repos
{"datomic-cloud"
{:url "<s3://datomic-releases-1fc2183a/maven/releases>"}}
:aliases
{:test
{:extra-paths
["test"]
:extra-deps
{nubank/matcher-combinators {:mvn/version "3.1.3"}
lambdaisland/kaocha {:mvn/version "1.0.700"}}}}
}
i tried brew install clojure
and run /usr/local/bin/clojure
directly; same result.
i haven't tried it under linux yet, but it feels like a tools.deps.alpha
issue.
I don't think the os matters so no reason to do that
i just retried again on a different machine: no error:
$ /nix/store/0v7kwppxygj3wln9j104vfi1kx21fssj-clojure-1.10.1.590/bin/clojure -Srepro -e "(require 'datomic.client.api)"
analyzer error:
$ /nix/store/9g4xqjpzi7vkr5a5n2q3fd1cyymvh68r-clojure-1.10.1.697/bin/clojure -Srepro -e "(require 'datomic.client.api)"
these are the differences in the dependency tree:
$ diff -u <(/nix/store/0v7kwppxygj3wln9j104vfi1kx21fssj-clojure-1.10.1.590/bin/clojure -Srepro -Stree) <(/nix/store/9g4xqjpzi7vkr5a5n2q3fd1cyymvh68r-clojure-1.10.1.697/bin/clojure -Srepro -Stree)
--- /dev/fd/63 2020-10-05 21:48:46.147069426 +0800
+++ /dev/fd/62 2020-10-05 21:48:46.147513695 +0800
@@ -31,10 +31,6 @@
com.datomic/client-api 0.8.54
org.clojure/core.async 0.5.527
org.clojure/tools.analyzer.jvm 0.7.2
- org.clojure/tools.analyzer 0.6.9
- org.clojure/tools.reader 1.0.0-beta4
- org.clojure/core.memoize 0.5.9
- org.ow2.asm/asm-all 4.2
com.cognitect/http-client 0.1.105
org.eclipse.jetty/jetty-http 9.4.27.v20200227
org.eclipse.jetty/jetty-io 9.4.27.v20200227
I'm looking at it, give me a bit
1π1β€οΈthis is a tools.deps bug - it's pretty subtle and will take me a bit to isolate and fix properly but adding a top level dep on org.clojure/core.async 0.5.527 should be a sufficient workaround for the moment
thank you!
@oscarlinusericsson yep, and I do this. But anyway I need a criteria, are some ids temporary, for resolving it that way. Or you suggest to resolve any id as temporary first, and if it is not resolved this way (or throws an exception), then it probably is a real id and trying to use it an non-temporary?
with that core.async, it worked on my side too
@nando I am a Datomic noob myself, but I got curious about the proposed enhanced doc (+1 on that, btw) and how :with
might work and ran a little experiment:
(d/q '[:find ?year
:with ?language
:where [?artist :artist/name "Bob Dylan"]
[?release :release/artists ?artist]
[?release :release/year ?year]
[?release :release/language ?language]]
db) ;; => [[1968] [1973] [1969] [1970] [1971]]
So to my unwitting eyes, the :with
per se does not block collapsing of duplicates: rather, one must concoct a :with
clause based on domain knowledge to force a bag
with the desired population over which to aggregate. Maybe? π€·if you create your ids with datomic.api/tempid
then you can check if they are an instance of datomic.db.DbId
. But that requires your code to use the tempid
function, of course.
If you transact data with tempids, that already can be resolved to entities (through external indexes and more), the tempids can be resolved to already existing entities, yes. Tempids do not have to create new entities, they can be resolved to already existing entities.
The columns in the initial set are with+find, (in this case ?year ?language), then aggregation happens, then the :with columns are removed (in this case ?language) leaving a bag
maybe itβs easier to think of it as :find ?year ?language :removing ?language
instead of :find ?year :with ?language
@hiskennyness I can only respond by saying that I think :with
is a very important clause to understand, and I'm not sure I fully understand it yet. Your example is the first I've seen targeting an attribute rather than an entity id. I don't have sufficient grasp of the inner workings of datomic or concept behind :with
to make a guess how that works, but I'm easily confused.
You remind me of this gem: https://ace.home.xs4all.nl/Literaria/Poem-Graves.html. I have been toying with doing a ground-up Datomic for the Easily Confused tutorial series, maybe I should do it as I struggle up my own learning curve.
That's a very helpful explanation.
If you do a tutorial series, of course please send the link!
1πhow do I create a client with datomic.client.api
with datomic free?
can I even use datomic.client.api
with datomic free?
Yes you have to run a peer server with datomic free to do that. See: https://docs.datomic.com/on-prem/peer-server.html
@timok Datomic free does not support peer server
@timok You should look at dev-local: https://docs.datomic.com/cloud/dev-local.html
^ no cost way to use datomic client library locally
I have it running a peer server here...
Datomic Pro Starter, which is free (no cost) does include peer server
Ok so I am running that not free then. Sorry for the confusion.
alright, thanks...will try dev-local then
i would like to implement some cognito triggers, using ions.
how can i see what payload does an api service calls an ion with?
can i "log" such info to some standard location easily?
for example, where can i see, if i just clojure.pprint/pprint
something in an ion?
@onetom https://docs.datomic.com/cloud/ions/ions-monitoring.html#events
1πhey, a new prerelease of clj is out if you'd like to test it - 1.10.1.708, will promote to stable after a bit more use
and I guess I implied but should say that it fixes this problem - thanks for the report, it would have been challenging to find this otherwise!
1π1