This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-07
Channels
- # babashka (7)
- # beginners (218)
- # boot (1)
- # chlorine-clover (2)
- # cider (36)
- # cljsrn (8)
- # clojure (71)
- # clojure-dev (9)
- # clojure-europe (11)
- # clojure-france (1)
- # clojure-italy (5)
- # clojure-nl (5)
- # clojure-uk (24)
- # clojurescript (9)
- # conjure (16)
- # cursive (65)
- # datomic (76)
- # devcards (21)
- # emacs (1)
- # etaoin (1)
- # figwheel-main (47)
- # fulcro (37)
- # hyperfiddle (9)
- # java (2)
- # kaocha (1)
- # malli (11)
- # music (14)
- # observability (8)
- # off-topic (32)
- # re-frame (13)
- # reagent (2)
- # reitit (5)
- # ring (3)
- # shadow-cljs (40)
- # slack-help (17)
- # spacemacs (15)
- # tools-deps (5)
- # xtdb (16)
Trying to retract a non-existing entity does not fail in 0.9.5951
and later.
Is that intentional?
Here is my code:
@(d/transact conn [#:db{:ident :order/id, :cardinality :db.cardinality/one, :valueType :db.type/string, :unique :db.unique/identity}])
@(d/transact conn [[:db/retractEntity [:order/id "missing"]]])
; no error in 0.9.5951 (and later)
; error in 0.9.5930:
; datomic.impl.Exceptions$IllegalArgumentExceptionInfo: :db.error/not-an-entity Unable to resolve entity: [:order/id "missing"]
; java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: :db.error/not-an-entity Unable to resolve entity: [:order/id "missing"]
Thanks!## Changed in 0.9.6021
* Fix: Prevent a rare scenario where retracting non-existent entities
could prevent future transactions from succeeding.
Maybe. But the change of behaviour already happened in 0.9.5951, so I'm not sure 0.9.6021 would affect that
Hello.
How do I go about declaring a tuple of instants?
(d/transact conn {:tx-data [{:db/ident :foo/bar
:db/valueType :db.type/tuple
:db/tupleType :db.type/instant
:db/cardinality :db.cardinality/one}
]})
And then when I insert, I did the following:
(d/transact conn {:tx-data [{:foo/bar [#inst "2020-10-10"]}]})
As @ghadi pointed: https://docs.datomic.com/cloud/schema/schema-reference.html#tuples
A tuple is a collection of 2-8 scalar values, represented in memory as a Clojure vector. There are three kinds of tuples:
It says its an invalid tuple value
Ah! Such a silly error! Thanks. So how do I model something that might have a range of 1 to 5 dates?
as a many cardinality?
Ok. got it
The dates represent a range of dates on which a certain tournament occurred. The tournament may range anywhere from 1 to 6 days
Often, not necessarily, there might be rest days etc
I could obviously simply date range it and say :date/from :date/to
But, the tuple can also preserve order which might become important when querying, potentially
You mean have the date as a {:db/ident #inst “some date” }
Interesting…
so just :tournament/date has 1-6 values
yeah. Got it
Right. Got it
yeah, that’s certainly an option. That’s what I was wondering.
Cool. I’ll figure it out. Thanks for the help
I had a question around composite tuples.
so let us say I have a match played between two teams on certain dates
does it make sense to turn this into a composite tuple?
Assume that the two teams are actually db/ref
It is likely each of the teams have thousands of entries
I could potentially query thousands of matches that are of specific teams
give me the final score of all matches played between two teams in a given date range
[:find (pull ?match [:match/score])
:where
[?match :participating/team ?t1]
[?match :participating/team ?t2]
[?match :tourney/dates ?d]
[(>= ?d ?start-date)]
[(<= ?d ?end-date)]]
yeah, that’s mostly it
they don’t
basketball
Ah. There’s no easy place for easy open NBA data. ESPN took their API down
Thanks a ton mate.
@srijayanth I was using https://www.mysportsfeeds.com/ for NBA data
admittedly the project I was using it on was OK with stale data from last season, but they have live subscriptions. Not sure what your budget is.
@jaret - thanks
Cool.
Thanks.
If you’re on the datomic team, that puts you on the east coast….Knicks fan?
I hope not.
Ah. The late 90s teams of the Pacers were really good. Early 2000s too.
the PG era is a bit too R for me