This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-26
Channels
- # announcements (2)
- # aws (4)
- # babashka (5)
- # beginners (91)
- # calva (4)
- # cider (17)
- # clara (13)
- # clj-kondo (14)
- # cljsrn (11)
- # clojure (159)
- # clojure-europe (2)
- # clojure-nl (14)
- # clojure-norway (2)
- # clojure-taiwan (2)
- # clojure-uk (32)
- # clojurescript (101)
- # clojutre (4)
- # cursive (13)
- # data-science (1)
- # datomic (46)
- # emacs (68)
- # figwheel-main (5)
- # fulcro (48)
- # graalvm (7)
- # graphql (6)
- # instaparse (5)
- # joker (4)
- # lambdaisland (1)
- # leiningen (2)
- # malli (9)
- # off-topic (41)
- # pedestal (15)
- # re-frame (47)
- # reagent (7)
- # reitit (14)
- # shadow-cljs (180)
- # spacemacs (58)
- # specter (1)
- # tools-deps (13)
When I create entities I always give them an attribute called :base/type
, which is just a keyword, for instance :bank-account
. I'd like to find all the entities (preferably that I've created) that don't have this attribute. I've asked this on Stack Overflow: https://stackoverflow.com/questions/58866423/find-all-entities-that-are-missing-a-particular-attribute, but no answers...
@U0D5RN0S1 you would have to somehow reduce the number of entities to check otherwise you're doing a full db scan. So I would write first the clause to identify all the entities you've created and then from those, find all the entities without this attribute.
Unfortunately it is not explained in the missing?
section of the docs and all examples just happend to have clauses before the missing?
predicate that makes the query work (`[?artist :artist/name ?name]`)
Thanks @U963A21SL that brings things together for me. I can work with knowing the name of an attribute in the entity that may not have a :base/type
.
[:find [?entities ...]
:in $ :where
[?entities ::rule/splits ?s]
[(missing? $ ?entities :base/type)]]
Where do I find the upgrade instructions from solo to production?
Just choose a production compute stack instead of a solo compute stack. You should be running a split stack first
An attribute which is unique by identity allows us to use its value instead of a :db/id
to identify an entity within a transaction. If no entity exists with that value then an entity is created, otherwise facts are stored about the existing entity.
Do composite tuples work the same way? They are also :db.unique/identity
, however they seem to operate more like :db.unique/value
in that they throw an exception when the tuple value already exists.
Or in other words, can I take advantage of a tuple to update an existing entity? For example, change this player's colour based on the combination of their first and last name:
{:tx-data [{
; composite tuple attributes:
:player/first-name "Jean-Luc"
:player/last-name "Picard"
; some fact to store about the existing entity
:player/colour "blue"
}]}
Edit: the code example throws a Unique conflict exception when transacted a second timeYou can indeed use a composite tuple for identity and upsert. You have to include the tuple itself in the transaction So in your example, if the unique attribute is called :player/first+last, you need to include a value for :player/first+last in your next transaction to get upsert
FYI, discussed here also: https://forum.datomic.com/t/db-unique-identity-does-not-work-for-tuple-attributes/1072
I came across that post a few months ago when I first encountered the same problem, but to be honest I didn't understand the resolution in the comments.
i'm attempting to transact a tuple ident and am getting the following exception:
(d/transact (client/get-conn)
{:tx-data [
{:db/ident :user/first+last
:db/valueType :db.type/tuple
:db/tupleAttrs [:user/first :user/last]
:db/cardinality :db.cardinality/one
:db/unique :db.unique/identity}
]})
Unable to resolve entity: :db/tupleAttrs
any ideas? i have no problem transacting it to another database an hour ago.is it technically possible/viable to downgrade the production primary compute group instance type to something cheaper as long as you don't have users?
i can see that
reducing asg size
thanks
still, its a factor ten price difference at least
also, you can ‘turn off’ the system over nights/weekends if it’s not a user-facing prod system
as long as my customer is not live, I will have difficulty explaining this price to him
simultaneously, I need the architecture at some point, to develop against prod. only features like http-direct
or have staging/test query group separation
i need the platform running for 1-5 users testing on the customer site
turn off is no option