This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-05
Channels
- # announcements (17)
- # aws (1)
- # babashka (68)
- # beginners (88)
- # calva (85)
- # chlorine-clover (10)
- # cider (5)
- # cljsrn (4)
- # clojure (99)
- # clojure-android (1)
- # clojure-denmark (1)
- # clojure-europe (15)
- # clojure-italy (5)
- # clojure-nl (3)
- # clojure-spec (1)
- # clojure-uk (67)
- # clojurescript (44)
- # core-async (44)
- # cryogen (4)
- # cursive (22)
- # data-science (2)
- # datascript (10)
- # datomic (29)
- # duct (11)
- # editors (2)
- # emacs (2)
- # events (1)
- # fulcro (28)
- # ghostwheel (7)
- # graalvm (8)
- # instaparse (6)
- # java (34)
- # jobs (9)
- # jobs-discuss (71)
- # juxt (12)
- # luminus (3)
- # malli (15)
- # meander (9)
- # nrepl (4)
- # off-topic (44)
- # pathom (13)
- # reagent (22)
- # schema (1)
- # shadow-cljs (39)
- # spacemacs (2)
- # test-check (1)
- # tree-sitter (5)
- # xtdb (5)
- # yada (1)
this is sort of related to datomic, so I thought I might find people who knew here: is it possible to statically analyze a query and always know all of the attributes that a query depends on?
No, as attrs to match can be input, dynamically built, or you can call an arbitrary function
> dynamically built can you show me what you mean by that? the other two make sense
No, as attrs to match can be input, dynamically built, or you can call an arbitrary function
@lvbarbosa @favila Iām struggling with the same problem, but I want to match on multiple attributes and the matches to exclude is stored in datomic as well (not as separate input). E.g. a list of items:
[
{:item/department "D1" :item/type "A"}
{:item/department "D1" :item/type "B"}
{:item/department "D1" :item/type "C"}
{:item/department "D2" :item/type "B"}
{:item/department "D3" :item/type "A"}
{:item/department "D3" :item/type "C"}
]
And a list of tuples with [dep type]
s to hide:
{:item/hidden [["D1" "A"] ["D3" "C"]]}
I got it working with the following query:
(d/q {:query '[:find (pull ?item [...])
:where
[?item :item/department ?dep]
[?item :item/type ?type]
[(tuple ?dep ?type) ?dep+type]
[(q '[:find (set ?hidden)
:where [_ :item/hidden ?hidden]] $) [[?results]]]
(not [(contains? ?hidden ?dep+type)])]
:args [db]})
But Iām not sure about using the set
function in the find clause of the subquery (itās not documented). And Iām not sure if there is an easier/more performant way to do ituse distinct
instead of set
(honestly it might just be an alias for set) https://docs.datomic.com/cloud/query/query-data-reference.html#built-in-aggregates
I adjusted my actual case and typed it over, so it has an error. The ?hidden should be ?results.
Does distinct
always yield a set? I assumed it would be a seq, like clojure.core/distinct.
Thanks for the feedback, Iāll try different approaches to see if there is a performance difference
hi, does someone know how to get statistics of Datomic database (total size, size by entity, index size ā¦)?
@hawkey Using the Client API: https://docs.datomic.com/client-api/datomic.client.api.html#var-db-stats
does the schema of the one that didnt ārepurposeā include a uniqueness attribute?
the failed repurposed ident was originally claimed by a ref attribute which was included in a unique composite tuple. i removed the unique constraint on that tuple, but i still get the same exception.
looking at the alias, and the tuple attr which refers to that alias, neither have a unique constraint
so the whole thing looks more like this:
1. :player/details
, claimed by a ref attribute, aliased to :new-player/details
2. :player/details+region
tuple attribute aliased to :new-player/details+region
3. unique by identity constraint removed from :new-player/details+region
tuple attribute
4. transact {:db/ident :player/details :db/valueType :db.type/ref :db/cardinality :db.cardinality/one}
Ident :player/details cannot be used for entity 666, already used for :new-player/details